|
![Picture of renaud Picture of renaud](/graphics/unknown.gif) renaud - 2006-07-04 18:18:42 - In reply to message 10 from László Zsidi
Hi,
First of all, thanks for your explanations. Your english is really better than mine, no problem !
I still have a problem with the delay:
my delay variable is
$int = 1.5;
//then, the params of the class
for($i = 1; $i<= $nb_im; $i++)
{
$dossier="ban_temp/gif";
$nom = "banniere".$i."".$ip.".gif";
$frames[$i] = "".$dossier."/".$nom."";
$interval[$i] = $int * 1000;
$x[$i] = 0;
$y[$i] = 0;
}
$gif = new GifMerge($frames, 1, 1, 1, -10, $interval, 2, $x, $y, 'C_FILE');
Normally, the delay should be 1500 milliseconds, so 1.5 second, isn't it ?
But in fact the delay is 9 seconds !
I precise that I let the var $dly = 50 in your class file.
And I don't understand...
![Picture of László Zsidi Picture of László Zsidi](/graphics/unknown.gif) László Zsidi - 2006-07-05 04:01:14 - In reply to message 11 from renaud
Hi,
Try to change the millisecunds multiplier to my mind so, that decrease your
millisecunds multiplier onto 1/100 and watch the time of replay.
In your example:
$delay = 1.5 * 100;
The assimilation of delay value is very simple.
The integer delay value will be processed so:
if($this->delay || $use_trans)
{
$this->buffer[0] = 0x21; // Extension Introducer (0x21)
$this->buffer[1] = 0xf9; // Graphic Control Label (0xf9)
$this->buffer[2] = 0x04; // Block Size (0x04)
$this->buffer[3] = ($this->disposal << 2) + ($use_trans ? 1 : 0);
/* Two byte for setting of frame delay */
$this->buffer[4] = $this->delay & 0xff; // Delay Time (1/100ths of a second) first bit
$this->buffer[5] = ($this->delay & 0xff00) >> 8; // Delay Time (1/100ths of a second) second bit
/* -- */
$this->buffer[6] = $use_trans ? $transindex : 0; // Transparent Color Index
$this->buffer[7] = 0; // Block Terminator(0x00)
$this->putbytes($this->buffer,8);
}
Best regards
![Picture of renaud Picture of renaud](/graphics/unknown.gif) renaud - 2006-07-05 08:10:41 - In reply to message 12 from László Zsidi
Hello,
Yes it seems ok with 100.
THanks a lot and best regards.
![Picture of renaud Picture of renaud](/graphics/unknown.gif) renaud - 2006-07-07 14:06:45 - In reply to message 13 from renaud
Hi,
This class is really fantastic ! great thanks. Just a last thing: I see the animated gif on my screen with no problem. However how can I do to give a name and save the gif in a specified folder ?
Thanking you in advance
Best Regards
![Picture of László Zsidi Picture of László Zsidi](/graphics/unknown.gif) László Zsidi - 2006-07-07 18:01:27 - In reply to message 14 from renaud
Hi,
Thank for your regard!
Yes of course you can be saved with whatever filename with 'C_FILE' parameter.
First of all fill up the frames array with the paths of frames e.g.:
$framespath = "./your_frames_path/";
if ($dh = opendir($framespath))
{
$cnt = 0;
while (false !== ($images = readdir($dh)))
{
if ($images != "." && $images != "..")
{
$frames[$cnt] = $framespath . $images;
$framed[$cnt] = 50;
$framex[$cnt] = 0;
$framey[$cnt] = 0;
$cnt++;
}
}
closedir($dh);
}
,call the GifMerge constructor:
$animatedGIF = new GifMerge($frames, 0, 0, 0, -10, $framed, 2, $framex, $framey, 'C_FILE');
,and finally save to file:
$savedpath = "./queue/your_name.gif";
fwrite(fopen($savedpath, "wb"), $animatedGIF->getAnimation());
Your animated GIF will be saved onto specified directory with specified name.
Best regards, László Zsidi
![Picture of renaud Picture of renaud](/graphics/unknown.gif) renaud - 2006-07-08 10:05:32 - In reply to message 15 from László Zsidi
Hi László
I just tested your code this morning, great ! I can save the gif on the specified folder. Do you know why the Windows viewer cannot read this image ? Compression ? algorythm ? What is the difference between this kind of animated gif and a one made by a soft like ImageReady (for example) ?
However, if I call this image on a web page with an <img src=""..> there's no problem.
Have a nice day.
Renaud (France)
![Picture of László Zsidi Picture of László Zsidi](/graphics/unknown.gif) László Zsidi - 2006-07-08 13:12:12 - In reply to message 16 from renaud
Hi,
Windows image viewer use another gif decoding method most likely, but other image viewers (irfanview, etc) is ok.
I would like to rewrite the image descriptor block in the next version for correct the reading/displaying errors of windows viewer.
![Picture of László Zsidi Picture of László Zsidi](/graphics/unknown.gif) László Zsidi - 2006-07-08 15:34:59 - In reply to message 16 from renaud
Hi,
Good news!
Rewieved the sourcecode and find some errors.
First of all I corrected the write out of 'NETSCAPE2.0' block.
The last 2 bytes from 19 bytes was wrong (0x00 and 0x00 represented 0xFE and 0xF8)
The missed file terminator byte (0xb3) caused reading error at image reading of Windows image viewer.
Updated package with correted class.
![Picture of renaud Picture of renaud](/graphics/unknown.gif) renaud - 2006-07-08 16:27:28 - In reply to message 18 from László Zsidi
Congratulations for your quick reaction !
Did you test your new version ? I just downloaded and test :
echo $animatedGIF -> getAnimation(); still not work. I don't see the gif on my screen.
The save is ok, the windows viewer ok...but only the first frame. The gif is not animated...
![Picture of renaud Picture of renaud](/graphics/unknown.gif) renaud - 2006-07-08 16:43:08 - In reply to message 19 from renaud
Oooops ! This is my mistake !
In my configuration, I have to change this line (N° 109) of your script:
for($i = 1; $i <= count($images); $i++)
instead of
for($i = 0; $i < count($images); $i++)
And All works very fine ! viewer, animated...all !
Great !!!!!
|