added function to scale images on upload