Jump to content

GIF displayed as JPg after resizing


cleeclee

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/268006-gif-displayed-as-jpg-after-resizing/
Share on other sites

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.

 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.