note 83297 deleted from function.imagegif by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 11:00:06 +0000 |
| Subject: | note 83297 deleted from function.imagegif by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196999@lists.php.net to get a copy of this message | ||
Note Submitter: mogmios at gmail dot com
----
Simple function for converting a PNG to a GIF. Seems to work for me.
<?php
function png2gif ( $image_in, $image_out ) {
$img = imagecreatefrompng ( $image_in );
$trans_color = imagecolortransparent ( $img );
$trans_index = imagecolorallocate ( $img, $trans_color['red'],
$trans_color['green'], $trans_color['blue'] );
imagecolortransparent ( $img, $trans_index );
imagegif ( $img, $image_out );
return True;
}
?>