1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| <?php parse_str($_SERVER['REDIRECT_QUERY_STRING']);
$button_dir = '/buttons/'; $url = $_SERVER['REDIRECT_URL']; $root = $_SERVER['DOCUMENT_ROOT'];
$ext = substr($url,strrpos($url,'.'));
$file = substr($url,strlen($button_dir),strlen($ext));
$file = str_replace('..','',$file);
$text = urldecode($file);
if (!isset($font)) $font='../../../../Media/font/times'; if (!isset($size)) $size =12; $im = ImageCreateFromPNG('../../../../Media/Photo/image/1.png'); $tsize = ImageTTFBBox($size, 0, $font, $text); $dx = abs($tsize[2] - $tsize[0]); $dy = abs($tsize[5] - $tsize[3]); $x = (ImageSx($im) - $dx) / 2; $y = (ImageSy($im) - $dy) / 2 + $dy; $black = ImageColorAllocate($im, 0, 0, 0);
ImageTTFText($im, $size, 0, $x, $y, $black, $font, $text); header('Content-Type:image/png'); ImagePNG($im); ImagePNG($im,$root.$button_dir."$file.png"); ImageDestroy($im); ?>
|