Page 1 of 1

using gd2 to convert images to jpeg fomat

Posted: Mon Aug 29, 2005 9:14 am
by jasongr
Hello

I am tying to use gd2 to convert a photo to the jpeg format
The photo can either be: png, bmp or gif
can anyone know how this can be done?
I would appreciate a code sample, or a reference to the right gd2 functions

regards

Posted: Mon Aug 29, 2005 10:29 am
by feyd
use getimagesize() to find the type you are dealing with. Use imageCreateFromPNG()/imageCreateFromGIF()/imageCreateFromBMP() to load the image, and imageJpeg() to dump it back out..


Moved to Graphics.

Posted: Mon Aug 29, 2005 10:53 am
by onion2k
imagecreatefrombmp() is not a PHP function.

Posted: Mon Aug 29, 2005 11:00 am
by feyd