PHP Classes

Using GIFEncoder in conjunction with GIFDecoder

Recommend this page to a friend!

      GIF images into animated GIF with native PHP class  >  All threads  >  Using GIFEncoder in conjunction with...  >  (Un) Subscribe thread alerts  
Subject:Using GIFEncoder in conjunction with...
Summary:Using GIFEncoder after GIFDecoder gives damaged GIFs
Messages:1
Author:Omar Abdel-Wahab
Date:2009-08-18 11:57:33
 

  1. Using GIFEncoder in conjunction with...   Reply   Report abuse  
Picture of Omar Abdel-Wahab Omar Abdel-Wahab - 2009-08-18 11:57:33
Hello there and thank you for the immense effort you put and the amazing class.

I was using your GIFEncoder to merge GIF slides extracted from an animated GIF decoded by your nice GIFDecoder. The idea is to watermark an animated GIF. This process seemed to result in damaging my GIF files.

Any ideas what I am missing here?
==================================
<?php
// Decode the old GIF file
$gifDecoder = new GIFDecoder(fread(fopen($image, "rb"), filesize($image)));
// Merge all frames
$gifEncoder = new GIFEncoder($gifDecoder->GIFGetFrames(),
$gifDecoder->GIFGetDelays(),
$gifDecoder->GIFGetLoop(),
$gifDecoder->GIFGetDisposal(),
$gifDecoder->GIFGetTransparentR(),
$gifDecoder->GIFGetTransparentG(),
$gifDecoder->GIFGetTransparentB(),
'bin');
// Cache the generated image
fwrite(fopen('newimage.gif', "wb"), $gifEncoder->GetAnimation());
// Result: an animated GIF that has lots of details lost in all frames except the first frame
?>
===================================

Thanks again.