Hi,
This is another intersting topic. If you want to make a frame based animated GIF file using PHP, then this post is exactly what you need. First of all you need to include() the class file in your .php file. The class is attached at the end of this post. The basic idea of creating a framed based animation is to create to arrays. the first array will contain the path of the frames, which basically are simple image file and the second array will define the duration one particular frame will have. e.g.
if ( $dh = opendir ( "frames/" ) ) {
while ( false !== ( $dat = readdir ( $dh ) ) ) {
if ( $dat != "." && $dat != ".." ) {
$ext=substr($dat,-3,3);
if(strtolower($ext)=="gif"){
$frames [ ] = "frames/$dat";
$framed [ ] = 5;
}
}
}
closedir ( $dh );
}
In the above code $frames[] holds the path of each image file which are in "frames/" directory, and $framed has the duration of each frame respectively. You can customize the above code as per your need.
The main trick of creating the animated single GIF file is:
This is another intersting topic. If you want to make a frame based animated GIF file using PHP, then this post is exactly what you need. First of all you need to include() the class file in your .php file. The class is attached at the end of this post. The basic idea of creating a framed based animation is to create to arrays. the first array will contain the path of the frames, which basically are simple image file and the second array will define the duration one particular frame will have. e.g.
if ( $dh = opendir ( "frames/" ) ) {
while ( false !== ( $dat = readdir ( $dh ) ) ) {
if ( $dat != "." && $dat != ".." ) {
$ext=substr($dat,-3,3);
if(strtolower($ext)=="gif"){
$frames [ ] = "frames/$dat";
$framed [ ] = 5;
}
}
}
closedir ( $dh );
}
In the above code $frames[] holds the path of each image file which are in "frames/" directory, and $framed has the duration of each frame respectively. You can customize the above code as per your need.
The main trick of creating the animated single GIF file is: