What I would like to do is as follows.
I have two php scripts which when run use gd to create dynamic images, each one is basically the same image with a different piece of text within the image dynamically created from info passed to it in the GET variable
Now independantly both of these work great
BUT
What I want to do now is using php I want to somehow be able to call both of these dynamic images into an animated image that is displayed to the user
I do not wish to generate and save an animated gif file every time this happens and to redirect to that file as that will not work and will be way to intense for the amount of users
I need something that can do everything as a user views a page with an image tag on it the image called would be a php script, this script would create an animated image from one statick background image and two different text strings each different text string would be put onto a seperate frame of the animation along with the background image thus creating a two frame animation
Possible??
If so how?
I have tried several scripts but most either dont do what i need or involve saving the file to a gif first then calling it which just will not work as the user volume would mean too much files being saved and called and no guarantee that the user gets the image created if another user visits right as he does and it generates and saves a different image or something and displays same for both users or what ever
Anyway got off track a bit there
So if anyone can point me in the right direction i would appreciate that
Below is the code im using to generate an image with dynamic text and static background then im saving it to a temp name running the GIFEncoder.class.php script to combine that temp file with another file stored on the server and then once its done and displayed the animated image to screen im deleting the temp file using unlink
Is there a way i can do all this with another script that doesnt require me to have the files saved on the server first??
Thanks
[CODE]<?php
$cname = $_GET[‘cname’];
$pic = “video-header.gif”;
$im = imagecreatefromgif($pic); /* Attempt to open */
$white = imagecolorallocate($im, 255, 255, 255);
$stringa = $cname;
//Tell gd2, where your fonts reside
putenv(‘GDFONTPATH=’.$_SERVER[‘DOCUMENT_ROOT’].”/mtionline/images/”);
$fontttf = ‘font’;
imagettftext($im, 15, 0, 12, 21, $white, $fontttf, $stringa);
//imagettftext(im,size,angle,x,y,col,font,text);
//imagestring($im, 2, 2, 2, $stringa, $black);
header(“Content-type: image/gif”);
$tempfilename = rand(10293029,94990292894);
imagegif($im,”frames/”.$tempfilename.”.gif”);
imagedestroy($im);
include(“GIFEncoder.class.php”);
/*
Build a frames array from sources…
if ( $dh = opendir ( “frames/” ) ) {
while ( false !== ( $dat = readdir ( $dh ) ) ) {
if ( $dat != “.” && $dat != “..” ) {
$frames [ ] = “frames/$dat”;
$framed [ ] = 5;
}
}
closedir ( $dh );
} */
$frames[] = “frames/”.$tempfilename.”.gif”;
$framed[] = 140;
$frames[] = “frames/image2.gif”;
$framed[] = 140;
/*
GIFEncoder constructor:
=======================
image_stream = new GIFEncoder (
URL or Binary data ‘Sources’
int ‘Delay times’
int ‘Animation loops’
int ‘Disposal’
int ‘Transparent red, green, blue colors’
int ‘Source type’
);
*/
$gif = new GIFEncoder (
$frames,
$framed,
0,
2,
0, 0, 0,
“url”
);
/*
Possibles outputs:
==================
Output as GIF for browsers :
– Header ( ‘Content-type:image/gif’ );
Output as GIF for browsers with filename:
– Header ( ‘Content-disposition:Attachment;filename=myanimation.gif’);
Output as file to store into a specified file:
– FWrite ( FOpen ( “myanimation.gif”, “wb” ), $gif->GetAnimation ( ) );
*/
Header ( ‘Content-type:image/gif’ );
echo $gif->GetAnimation ( );
unlink(“frames/”.$tempfilename.”.gif”);
?>