how to make dynamic signature from an animated gifrequirements: php 5 & imagick
check phpinfo(); if you have it
Code
<?php
$charid = 112562; // your characters id
$animation = "./2gv7y91.gif"; // original gif
$fastimage = "./fastimg.gif"; // cached image (should not change)
$refresh = 60; // cache time in seconds
$font = "./BIRTH_OF_A_HERO.ttf";
if(mktime()-filemtime($fastimage)>$refresh) {
include('readxml.php');
$charr = readxml($charid);
$strings = array(
// array(size, rotation, posx, posy, color, font, text),
array(20, 0, 10, 20, "white", $font, $charr['name'].' '.$charr['lvl'].' '.$charr['class']),
array(20, 0, 10, 40, "white", $font, 'str '.$charr['str']),
array(20, 0, 10, 60, "white", $font, $charr['mqa'].' / '.$charr['mqp']),
);
$image = new Imagick($animation);
$draw = new ImagickDraw();
foreach ($image as $frame) {
for($i=0;$i<count($strings);$i++) {
$color = new ImagickPixel($strings[$i][4]);
$draw->setFillColor($color);
$draw->setFont($strings[$i][5]);
$draw->setFontSize($strings[$i][0]);
$frame->annotateImage($draw, $strings[$i][2], $strings[$i][3], $strings[$i][1], $strings[$i][6]);
}
}
file_put_contents($fastimage, $image->getImagesBlob());
header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
header('Pragma: no-cache');
}
header("Content-type: image/gif");
$image = new Imagick($fastimage);
echo $image->getImagesBlob();
?>
package
http://www.ls.dunaicapa.hu/anim.gif/anim.gif.rarhttp://www.ls.dunaicapa.hu/anim.gif