New Gallery: Use the master hostname to generate the thumb image url

This silences the 'Given IP address instead of hostname' warnings in the log.