pneudralics Posted June 10, 2009 Share Posted June 10, 2009 When I upload with the temp name I add a .gif to the image file thinking all images will be saved as gifs. Now when I use getimagesize and look at the type it's still a jpg. Is it possible to convert a jpg to gif? Quote Link to comment https://forums.phpfreaks.com/topic/161687-how-do-i-convert-image-type/ Share on other sites More sharing options...
Maq Posted June 10, 2009 Share Posted June 10, 2009 Is it possible to convert a jpg to gif? Yes. Found this piece of code here, should do what you want. $imgname = "image.jpg" $im = @imagecreatefromjpeg($imgname); /* Attempt to open */ header("Content-type: image/gif"); imagegif($im, "image.gif"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/161687-how-do-i-convert-image-type/#findComment-853135 Share on other sites More sharing options...
pneudralics Posted June 10, 2009 Author Share Posted June 10, 2009 Uhmm whats weird is when I look at the image through windows it recognize it as a gif, but when I use getimagesize and look at the type it sees it as a jpg. Thanks I'll take a look at the link. Quote Link to comment https://forums.phpfreaks.com/topic/161687-how-do-i-convert-image-type/#findComment-853140 Share on other sites More sharing options...
pneudralics Posted June 10, 2009 Author Share Posted June 10, 2009 Also curious if imagecreatefromjpeg supports jpg? getimagesize does not have any type for jpeg, but it has one for jpg. Quote Link to comment https://forums.phpfreaks.com/topic/161687-how-do-i-convert-image-type/#findComment-853143 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.