jonniejoejonson Posted February 13, 2008 Share Posted February 13, 2008 I would like to be able to upload and convert giff images to jpeg... is this possible using the gd library... any pointers... thanks to responders. J Link to comment https://forums.phpfreaks.com/topic/90958-convert-image-type/ Share on other sites More sharing options...
rhodesa Posted February 13, 2008 Share Posted February 13, 2008 Just use of one of the imagecreatefrom* functions to load it into GD, then imagejpeg() to save it to a new file Link to comment https://forums.phpfreaks.com/topic/90958-convert-image-type/#findComment-466190 Share on other sites More sharing options...
Psycho Posted February 13, 2008 Share Posted February 13, 2008 Here is a tutorial with the code to convert images from one type to another: http://www.phpit.net/article/image-manipulation-php-gd-part1/4/ Link to comment https://forums.phpfreaks.com/topic/90958-convert-image-type/#findComment-466193 Share on other sites More sharing options...
jonniejoejonson Posted February 13, 2008 Author Share Posted February 13, 2008 Thanks guys.. this is what i've come up with... $image = open_image($uploadFile); imagejpeg($image,'convertedImage.jpg',100); function open_image ($uploadFile) { # JPEG: $im = @imagecreatefromjpeg($uploadFile); if ($im !== false) { return $im; } # GIF: $im = @imagecreatefromgif($uploadFile); if ($im !== false) { return $im; } } Link to comment https://forums.phpfreaks.com/topic/90958-convert-image-type/#findComment-466219 Share on other sites More sharing options...
acctman Posted April 24, 2008 Share Posted April 24, 2008 Thanks guys.. this is what i've come up with... $image = open_image($uploadFile); imagejpeg($image,'convertedImage.jpg',100); function open_image ($uploadFile) { # JPEG: $im = @imagecreatefromjpeg($uploadFile); if ($im !== false) { return $im; } # GIF: $im = @imagecreatefromgif($uploadFile); if ($im !== false) { return $im; } } did the code above work for you? Link to comment https://forums.phpfreaks.com/topic/90958-convert-image-type/#findComment-526227 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.