Discussions


Chess, Go & Poker Server









                                          
User   Password   remember   (register)  ?

How to resize a GIF

Free online dating

Back to programming.


*kimaci    (2010-05-22)
How to resize a GIF


Hi all, here is a small script very useful that is able to resize a GIF while maintaining the transparency:

rename($_FILES['image']['tmp_name'], $image_path);

// chmod($image_path,0755);

list($photo_width,$photo_height) = getimagesize($image_path);
 
if ($img_size[2] == 1) $photo_resource = imagecreatefromgif($image_path);
elseif ($img_size[2] == 3) $photo_resource = imagecreatefrompng($image_path);
else $photo_resource = imagecreatefromjpeg($image_path);

$photo_resource_resized = imagecreatetruecolor($new_width, $new_height);

if ($img_size[2] == 1)
{
  $originaltransparentcolor = imagecolortransparent( $photo_resource );
  if ($originaltransparentcolor >= 0 && $originaltransparentcolor < imagecolorstotal($photo_resource))
{
  $transparentcolor = imagecolorsforindex( $photo_resource, $originaltransparentcolor );
  $newtransparentcolor = imagecolorallocate($photo_resource_resized, $transparentcolor['red'], $transparentcolor['green'],$transparentcolor['blue']);
  imagefill( $photo_resource_resized, 0, 0, $newtransparentcolor );
  imagecolortransparent( $photo_resource_resized, $newtransparentcolor );
}
}

imagecopyresampled($photo_resource_resized, $photo_resource, 0, 0, 0, 0, $new_width, $new_height, $photo_width, $photo_height);
 
if ($img_size[2] == 1) imagegif($photo_resource_resized,$image_path);
elseif ($img_size[2] == 3) imagepng($photo_resource_resized,$image_path);
else imagejpeg($photo_resource_resized,$image_path);




(more options below)

See also


ficgs
More websites

You must register to see these links, as this is a collaborative page, then you may change the order of the links by clicking the icons before the titles.



admin
Other websites

The following links might be less relevant, please change their ranks if you find them useful.


 Yahoo! Answers - Get answers, ask questions, find information
answers.yahoo > question/index%3Fqid%3D20080123080416AAFkmrg%2B
  1. Yahoo! does not evaluate or guarantee the accuracy of any Yahoo!
 Picasion - Create GIF animations online - Make an Animated GIF
picasion > resize image/&amp;sa=U&amp;ei= uRuUMuEIKGh0QWHgoHwCA&amp;

It stands for Graphics Interchange Format and, unlike jpg it is a...

 GIFs
ineedagif.tumblr

Sadly, after 20 minutes (or maybe even hours) of searching the...

 How to Resize Gif: 6 steps (with pictures) - wikiHow
wikihow > Resize Gif&amp;sa=U&amp;ei= uRuUMuEIKGh0QWHgoHwCA&amp;ved=

Create a Video Greeting Card With GoAnimate in YouTube...

 The Page or Image You Ask Not Available / Arad
uploadedit > to upload edit resize resample animated gif.htm%2B



Response  
  Smilies

Guest name   (optional)       Register for more options.



Trackbacks : If you talked about this article in your blog or website, you may instantly get a backlink 
  There's no trackback at the moment.











 

FICGS message




Discussions



 


Photo blog selected : lol

lol - August 29, 2012   lol - August 28, 2012   lol - August 27, 2012  
A new picture tomorrow morning, around 10 a.m.



 


Pagerank       Copy this code to display your site's Pagerank




Write upside down to your friends!   In your blog, anywhere...
(works with MySpace, Twitter, Facebook, Youtube, MSN, Hi5, Bebo, Yahoo...)






Tip of the day :

Promote your website & protect your Uptobox, Mega or Mediafire links !

Here is the simplest tool : Protect your links




FICGS is also a Free Internet Correspondence Games Server.

Here you can play Chess, Go & Poker Texas Holdem online for free in rated class tournaments and a unique world championship.

Free Internet Chess & Go Server


Feel free to link to this page and to FICGS chess server :