<?php
error_reporting(0);
$img = isset($_GET['img']) ? $_GET['img'] : '' ;
$w = 70;
$str = "";
$size = 1;
$q =70;
$ff = explode(".", $img);
$km = count($ff);
$km = $km - 1;
$format = $ff[$km];
if($format == "jpg")
{
$head = 'jpg';
$createfunc = 'imagejpeg';
$funci = "imagecreatefromjpeg";
}
else
if($format == "gif")
{
$head = 'gif';
$createfunc = 'imagegif';
$funci = "imagecreatefromgif";
}
else
{
$head = 'jpeg';
$createfunc = 'imagejpeg';
$funci = "imagecreatefromjpeg";
}
list(, , $type,) = getimagesize($img);
$im1 = $funci($img);
$w_src = imagesx($im1);
$h_src = imagesy($im1);
if($w_src > $w)
{
$ratio = $w_src/$w;
$w_dest = round($w_src/$ratio);
$h_dest = round($h_src/$ratio);
$dest = imagecreatetruecolor($w_dest,$h_dest);
imagecopyresampled($dest, $im1, 0,0,0,0,$w_dest,$h_dest, imagesx($im1), imagesy($im1));
}
else
if($w_src <= $w)
{
$dest = imagecreatetruecolor($w_src,$h_src);
imagecopyresampled($dest, $im1, 0,0,0,0,$w_src,$h_src, $w_src, $h_src);
}
$x_text = $w_dest-imagefontwidth($size)*strlen($str)-3;
$y_text = $h_dest-imagefontheight($size)-3;
$white = imagecolorallocate($dest, 255, 255, 255);
$black = imagecolorallocate($dest, 0, 0, 0);
$gray = imagecolorallocate($dest, 127, 127, 127);
if(imagecolorat($dest,$x_text,$y_text) > $gray) $color = $black;
if(imagecolorat($dest,$x_text,$y_text) < $gray) $color = $white;
imagestring($dest, $size, $x_text - 1, $y_text - 1, $str,$white-$color);
imagestring($dest, $size, $x_text + 1, $y_text + 1, $str,$white-$color);
imagestring($dest, $size, $x_text + 1, $y_text - 1, $str,$white-$color);
imagestring($dest, $size, $x_text - 1, $y_text + 1, $str,$white-$color);
imagestring($dest, $size, $x_text - 1, $y_text, $str,$white-$color);
imagestring($dest, $size, $x_text + 1, $y_text, $str,$white-$color);
imagestring($dest, $size, $x_text, $y_text - 1, $str,$white-$color);
imagestring($dest, $size, $x_text, $y_text + 1, $str,$white-$color);
imagestring($dest, $size, $x_text, $y_text, $str,$color);
header("Content-type: image/$head");
$createfunc($dest,'',$q);
?>
|