Welcome to WebmasterWorld Guest from 54.197.116.116

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP: How to convert all image formats to JPG

   
5:26 pm on Dec 8, 2008 (gmt 0)

5+ Year Member



I'm tired of Googling. If anyone can help me with this I would really appreciate it.

Is there an easy way to convert all images (PNG, GIF, BMP,...) to simple JPG format using GD or MagickWand?

Something like this:

1) upload image001 (PNG, GIF, BMP,...)
2) check image format image001
3) convert to image001.jpg

Thanks a lot.

1:30 am on Dec 9, 2008 (gmt 0)

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 5+ Year Member



A quick G search results in many applications (outside of PHP) that do this task. I would try to take advantage of them using system() calls. They will probably be faster, too.
10:42 am on Dec 10, 2008 (gmt 0)

5+ Year Member



When you have MagickWand installed, you also have ImageMagick installed, which comes with the very handy 'convert' command.

A simple system('convert /path/to/image001.BMP /path/to/image001.jpg') should do the trick.