pic _GET pic info getimagesize pic switch info mime case image jpeg im

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$pic = $_GET['pic'];
$info = getimagesize($pic);
switch($info['mime'])
{
case 'image/jpeg': $img = imagecreatefromjpeg($pic); break;
case 'image/gif': $img = imagecreatefromgif($pic); break;
case 'image/png': $img = imagecreatefrompng($pic); break;
default: exit(); break;
}
#$W = $info[0];
#$H = $info[1];
#$T = $info['mime'];
$x = imagesx($img);
$y = imagesy($img);
$black = imagecolorallocate($img, 0, 0, 0);
imagettftext($img, 20, $x, $y, 0, $black, 'font.ttf', 'Copyright');
header('Content-Type: image/jpeg');
imagejpeg($img, 75);