42 lines
1.5 KiB
PHP
42 lines
1.5 KiB
PHP
|
|
<?
|
||
|
|
error_reporting(LC_ALL);
|
||
|
|
ini_set('display_errors', 1);
|
||
|
|
$p = $_GET['p'];
|
||
|
|
$w = $_GET['w'];
|
||
|
|
$h = $_GET['h'];
|
||
|
|
$string = $_GET['string'];
|
||
|
|
|
||
|
|
$handle = imageCreatefromjpeg('/var/www/html/crm/'.$p);
|
||
|
|
$co="jpeg";
|
||
|
|
if(strstr($p,".jpg") || strstr($p,".jpeg")) {$handle = imageCreatefromjpeg($p);$co="jpeg";}
|
||
|
|
if(strstr($p,".gif")){$handle = imageCreatefromgif($p);$co="gif";}
|
||
|
|
if(strstr($p,".png")){$handle = imageCreatefrompng($p);$co="png";}
|
||
|
|
if($co=="jpeg")header("Content-type: image/jpeg");
|
||
|
|
if($co=="gif")header("Content-type: image/gif");
|
||
|
|
if($co=="png")header("Content-type: image/png");
|
||
|
|
$ow = imagesx($handle);
|
||
|
|
$oh = imagesy($handle);
|
||
|
|
/*
|
||
|
|
$imd = imagecreatetruecolor($w,$h);
|
||
|
|
imagecopyresized($imd,$ims,0,0,0,0,$w,$h,$ow,$oh);
|
||
|
|
*/
|
||
|
|
$black_picture = imageCreatetruecolor($w,$h);
|
||
|
|
imagefill($black_picture,0,0,imagecolorallocate($black_picture, 255, 255, 255));
|
||
|
|
imagecopyresampled($black_picture, $handle, 0, 0, 0, 0,$w, $h, $ow, $oh);
|
||
|
|
|
||
|
|
if($_GET['string']!="" && !@imagejpeg($black_picture,$dest_pict.'/mini_'.$pict, $size_in_pixel)){
|
||
|
|
$bg = imagecolorallocate($black_picture,0,0,255);
|
||
|
|
imagefilledrectangle($black_picture,0,$h-20,$w,$w,$bg);
|
||
|
|
imagestring($black_picture, 4, 10, $h-18, $_GET['string'],imagecolorallocate($black_picture,255,255,255));
|
||
|
|
}
|
||
|
|
|
||
|
|
imagejpeg($black_picture,'', '85');
|
||
|
|
imagedestroy($handle);
|
||
|
|
imagedestroy($black_picture);
|
||
|
|
/*
|
||
|
|
if($co=="jpeg"){header("Content-type: image/jpeg");imagejpeg($imd);}
|
||
|
|
if($co=="gif"){header("Content-type: image/jpeg");imagegif($imd);}
|
||
|
|
if($co=="png"){header("Content-type: image/png");imagepng($imd);}
|
||
|
|
*/
|
||
|
|
?>
|