resize and convert image to png before uploading to database