cleeclee Posted September 5, 2012 Share Posted September 5, 2012 Why does my gif file becomes a normal picture (jpg) after i resize it. Any ways I could re size and keep it as a gif. I'm a total newbie doing my final year project so i'll appreciate it if anyone who replies makes it easy for me to understand. I've attached the codes i used to begin designing the webpage so you guys can see better. <?php function EMS () { return ['a' => 'Energy Management Software']; } echo EMS() ['a']; $EMS = "Energy Management"; echo "<p style=\"text-align:center;\"><font size='16'><b>$EMS</b></font></p>"; $bgcolor="lightgreen"; echo "<body bgcolor='$bgcolor'>"; echo '<img src="picture.gif">'; include('SimpleImage.php'); $image = new SimpleImage(); $image->load('http://very-soft.com/media/products/screenshots/Energy_animation-site_1.gif'); $image->resize(120,400); $image->save('picture.gif'); ?> 18972_.txt Quote Link to comment https://forums.phpfreaks.com/topic/268006-gif-displayed-as-jpg-after-resizing/ Share on other sites More sharing options...
kicken Posted September 5, 2012 Share Posted September 5, 2012 Why does my gif file becomes a normal picture (jpg) after i resize it. Because your save function defaults to IMAGETYPE_JPEG if you don't pass anything else (which you're not). You need to either change your function to default to the value of $this->image_type, or pass in that value when you call the function. Quote Link to comment https://forums.phpfreaks.com/topic/268006-gif-displayed-as-jpg-after-resizing/#findComment-1375333 Share on other sites More sharing options...
cleeclee Posted September 5, 2012 Author Share Posted September 5, 2012 I only kinda understand. Would you be able to state explicitly where and what do i have to change? I tried changing the IMG_JPEG to IMG_GIF, and whatever that follows that needed to be changed. Doesn't work. I'm getting an image where by it is the original gif and not the resized one. Thank you again for such a fast reply. Quote Link to comment https://forums.phpfreaks.com/topic/268006-gif-displayed-as-jpg-after-resizing/#findComment-1375339 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.