PHP Classes

Saving output

Recommend this page to a friend!

      GIF images into animated GIF with native PHP class  >  All threads  >  Saving output  >  (Un) Subscribe thread alerts  
Subject:Saving output
Summary:Wondering how to save the output to server (as *.gif).
Messages:4
Author:Sak Cyma
Date:2009-01-17 04:51:30
Update:2009-01-19 05:58:14
 

  1. Saving output   Reply   Report abuse  
Picture of Sak Cyma Sak Cyma - 2009-01-17 04:51:30
Hey László,
Firstly thank you very much for the extremely useful and wonderful GIFEncoder. It's simple to use and I am extremely grateful for it.
I'm sort of new to php and I was wondering how to save the output to a file.
Eg.
$create = $gif->GetAnimation ( );
imagegif($create, "test.gif");

I want to get the animated gif created from the GIFEncoder and write it to file (test.gif).
I thank you or anyone for any support and once again thank you on this useful script.

  2. Re: Saving output   Reply   Report abuse  
Picture of Sak Cyma Sak Cyma - 2009-01-17 05:20:25 - In reply to message 1 from Sak Cyma
Hmm, I was able to save it using ob_get_contents() and then fwrite(). But I was wondering if there's a simpler way.

  3. Re: Saving output   Reply   Report abuse  
Picture of László Zsidi László Zsidi - 2009-01-19 05:57:04 - In reply to message 1 from Sak Cyma
The class output already GIF image data!
The store of the output into the server is very simple:

So, catch the animated output by $data = $gif->GetAnimation ( );
The $data variable will keep the binary image data begin with "GIF89a",
and to store this data add this line: fwrite ( fopen ( "animation.gif", "wb" ), $data );

Best regards

  4. Re: Saving output   Reply   Report abuse  
Picture of László Zsidi László Zsidi - 2009-01-19 05:58:14 - In reply to message 2 from Sak Cyma
Yes, of course:)