using gd2 to convert images to jpeg fomat

Need help with Photoshop, the GIMP, Illustrator, or others? Want to show off your work? Looking for advice on your newest Flash stuff?

Moderator: General Moderators

Post Reply
jasongr
Forum Contributor
Posts: 206
Joined: Tue Jul 27, 2004 6:19 am

using gd2 to convert images to jpeg fomat

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

imagecreatefrombmp() is not a PHP function.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Post Reply