|
|
|
|
для: cheops
(24.11.2007 в 12:20)
|
| Вот ресайз картинок на лету:
<?php
$filename = 'img.jpg';
$percent = 240; // Ширина изображения привью
header('Content-type: image/jpeg');
list($width, $height) = getimagesize($filename); // Получаем ширину и высоту большого изображения
$newheight = $height * $percent; // Перемножаем
$newwidth = $newheight / $width; // Делим
$thumb = imagecreatetruecolor($percent, $newwidth); // Цветное изображение
$source = imagecreatefromjpeg($filename); // JPEG
imagecopyresized($thumb, $source, 0, 0, 0, 0, $percent, $newwidth, $width, $height); // Создаем привью в во временный файл
imagejpeg($thumb);
?>
|
| |
|
|