February 10th, 2013, 12:44 PM
Converting After Upload
I would like to convert an image file to jpg directly after uploading, before saving to disk. What is the best way to do this?
February 10th, 2013, 12:49 PM
Why not just reject any image type that isn't a JPG for example GIF, PNG, BMP and ask the user to convert their file type to a JPG.
February 10th, 2013, 02:42 PM
The image is saved to the disk in a temporary location when it is uploaded; you can't convert it before that happens. However, you can convert it before you move the image into its final location on the disk.
PHP's GD extension could be used to perform the conversion, or on Linux you could use ImageMagick's convert command.