2
votes

In my web app users are allowed to upload images as their photos. How can I convert different image extensions to JPG? Input files are JPG, PNG or GIF.

3

3 Answers

2
votes

Personally, I prefer Image Magick over GD. It's a lot better if you're dealing with large images too; you can run into memory allocation issues with GD.

1
votes

With php, you can convert any image to an other using imagepng, imagejpeg, imagegif :

imagepng(imagecreatefromstring(file_get_contents($input)), 'output.png');

In this example, it will save the uploaded image in png with the path 'output.png'

0
votes