PHP Classes

how to use "lzw class" to compress gif?

Recommend this page to a friend!

      LZW  >  All threads  >  how to use "lzw class" to compress gif?  >  (Un) Subscribe thread alerts  
Subject:how to use "lzw class" to compress gif?
Summary:how to use "lzw class" to compress gif?
Messages:1
Author:sami alajrami
Date:2010-10-02 13:47:04
 

  1. how to use "lzw class" to compress gif?   Reply   Report abuse  
Picture of sami alajrami sami alajrami - 2010-10-02 13:47:07
i have used this class to compress a gif image for inserting it in to database ...thats the code which i used:

<? header("Content-Type: image/gif");
function upload(){
include("lzwc.php");
$l = new LZW;

$filename = "C:\\AppServ\\pta.GIF";
$handle = fopen($filename, "rb");
$imgfp = fread($handle, filesize($filename));
fclose($handle);
// echo $imgfp;
$en = $l->compress($imgfp);
$de = $l->decode($en);
echo $de;
//echo $en;
}
upload();
?>
when i echo "$imgfp" (the original image), its shown on the page..but when trying to output the "$de" or "$en" its not working
what would be erong in the code above ??!