Hallo
Also ich hab ne PHP Funktion, die mir aus Bildern Thumbnails erstellt.
Das klappt auch alles.
Wenn ich jetzt aber ein animiertes Gif verkleinern will ist es danach nicht mehr animiert.
Geht das mit PHP nicht anders, oder was muss ich ändern, dass das Bild danach auch noch animiert ist?
Hier die Funktion
Gruß ich
Also ich hab ne PHP Funktion, die mir aus Bildern Thumbnails erstellt.
Das klappt auch alles.
Wenn ich jetzt aber ein animiertes Gif verkleinern will ist es danach nicht mehr animiert.
Geht das mit PHP nicht anders, oder was muss ich ändern, dass das Bild danach auch noch animiert ist?
Hier die Funktion
PHP-Code:
function createThumbnail($imageFile, $thumbFile, $thumbMaxWidth, $thumbMaxHeight)
{
if (!($srcImg = @imagecreatefromgif($imageFile))) {
die("AGERROR:Konnte Thumbnail nicht erstellen.");
}
$origWidth = imagesx($srcImg);
$origHeight = imagesy($srcImg);
if ($origWidth > $origHeight) {
$ratio = $origWidth / $thumbMaxWidth;
$thumbWidth = $thumbMaxWidth;
$thumbHeight = ceil($origHeight / $ratio);
} else {
$ratio = $origHeight / $thumbMaxHeight;
$thumbHeight = $thumbMaxHeight;
$thumbWidth = ceil($origWidth / $ratio);
}
$thumbImg = imagecreatetruecolor($thumbWidth,
$thumbHeight);
imagecopyresampled($thumbImg, $srcImg, 0, 0, 0, 0,
$thumbWidth, $thumbHeight, $origWidth, $origHeight);
imagegif($thumbImg, "$thumbFile");
}
Kommentar