PHP Classes

It doesn't work good

Recommend this page to a friend!

      GIF images into animated GIF with native PHP class  >  All threads  >  It doesn't work good  >  (Un) Subscribe thread alerts  
Subject:It doesn't work good
Summary:GIFEncoder doesn't show any error message and my script n works
Messages:1
Author:yuytuty rtutru
Date:2013-03-20 20:50:14
 

  1. It doesn't work good   Reply   Report abuse  
Picture of yuytuty rtutru yuytuty rtutru - 2013-03-20 20:50:14
Hello (Sorry, I dont speak english very good)

A lot of thanks for this PHP Class, but it doesn't work good in my script
The example script works good, and another that I did too works.
But in this script the class doesn't work

<?
include "GIFEncoder.class.php";
$texto = "Funciona!";
$fuente = "./fuente.ttf";
$x = 1 ;
$y = 140 ;
$b = 60 ;
while ( ( $largo < $y) && ($alto < $b ) )
{
$cajaTexto = imagettfbbox($x, 0, $fuente, $texto);
$largo = $cajaTexto[2]-$cajaTexto[0];
$alto = $cajaTexto[1]-$cajaTexto[7];
$x = $x + 1 ;
}
$tamano = ($x - 2) ;

$cajaTexto = imagettfbbox($tamano, 0, $fuente, $texto);
$centrado = (150 - $largo) / 2;
$alt = ($alto / 2 );
$yCentrado = (75 + $alt) ;

$cen = ($centrado - 19);
$humo = $cajaTexto[0]-$cajaTexto[2];
//ancho de la imagen fuente
$y = 150 ;
$al = 0 ;
$da = 1 ;

while ( $humo < $y )
{
//cambiamos las images de fondo para crear los engranajes de RTU
if ($recurso == "a1.gif" )
{
$recurso = "a2.gif";
}
else
{
$recurso = "a1.gif" ;
}

$al = ($al + 1) ;
$im = imagecreatefromgif($recurso);
imagealphablending($im, true);
imagesavealpha($im, true);
$color = imagecolorallocate($im, 0, 255, 0);
$fuente = "./fuente.ttf";

$xCentrado = $humo;
//crear el fotograma centrado
if ($humo > $cen && $da <= 1)
{
$color = imagecolorallocate($im, 0, 0, 255);
imagettftext($im, $tamano, 0,$centrado , $yCentrado, $color, $fuente, $texto);
$cuadro = "frames/$al.gif" ;
Imagegif ($im, $cuadro);
$frames [ ] = "frames/$al.gif" ;
$framed [ ] = 200;
imagedestroy($im);

$humo = ($humo + 20) ;
$da = 2 ;
$al = ($al + 1) ;
$im = imagecreatefromgif($recurso);
imagealphablending($im, true);
imagesavealpha($im, true);
$color = imagecolorallocate($im, 0, 0, 0);
$fuente = "./fuente.ttf";
$xCentrado = $humo;
}

imagettftext($im, $tamano, 0, $xCentrado, $yCentrado, $color, $fuente, $texto);
$cuadro = "frames/$al.gif";
Imagegif ($im, $cuadro);
$frames [ ] = "frames/$al.gif";
$framed [ ] = 20 ;
imagedestroy($im);


$humo = ($humo + 20) ;

}


sleep(3);

$gif = new GIFEncoder (
$frames,
$framed,
0,
2,
255, 255, 255,
0,
"url"
);
Header ( 'Content-type:image/gif' );
echo $gif->GetAnimation ( );
?>

The scrpt generates the images but the gif does't work, and GIFEncoder does't show any error message

Bye bye and Thanks