<?php
if ($ext=="gif"){
$img = imagecreatefromgif(BASEDIR.$dir.'/'.$name);
$dst = imagecreatetruecolor($tn_width,$tn_height);
$colorTransparent = imagecolortransparent($img);
imagepalettecopy($img, $dst);
imagefill($dst, 0, 0, $colorTransparent);
imagecolortransparent($dst, $colorTransparent);
imagetruecolortopalette($dst, true, 256);
imagecopyresampled($dst, $img, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
$copy = imagecreatefromgif(BASEDIR.'images/img/copyright.gif');
imagecopy($dst, $copy, imagesx($dst)-imagesx($copy), imagesy($dst)-imagesy($copy), 0, 0, imagesx($copy), imagesy($copy));
header('content-type: image/gif');
header('Content-Disposition: filename="'.$name.'"');
imagegif ($dst);
imagedestroy($img);
imagedestroy($dst);
}
?>