Създаване на малко изображение с текст отдолу.
Въведох малко промени.
имаме 2 файла test.php и index.php
ето то test.php
<?php
$filename = 'sea.jpg';
$percent = 0.2;
$font = "arial";
$fontsize = 7;
header('Content-type: image/jpg');
list($width, $height) = getimagesize($filename);
$new_width = $width * $percent;
$new_height = $height * $percent;
$image_p = imagecreatetruecolor($new_width + 2, $new_height + 20);
$backgroundcolor = imagecolorallocate($image_p,5,90,177);
$background = imagefill($image_p,0,0,$backgroundcolor);
$image = ImageCreateFromJPEG($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
$tcolor = imagecolorallocate($image_p,255,255,255);
$t = "demo for http://web-tourist.net " . $width . "x" . $height;
$fontwidth = imagettfbbox($fontsize,0,$font,$t);
$g = abs($fontwidth[1]) + abs($fontwidth[2]);
imagettftext($image_p,$fontsize,0,$new_width / 2 - ($g / 2),$new_height + 14,$tcolor,$font,$t);
imagejpeg($image_p, null, 100);
?>а ето го и index.php
<a href=sea.jpg><img border=0 src=test.php></a>от $percent = 0.2; е зададено да стане на 20% от размера на голямата картинка.
index.php визуализира малкото изображение като е посочен и линк към оригинала.
ето линк ако не можете да намерите arial.ttf


