function to build an image url