Есть код на страничке
<img src="image.php?src=castles/ShkodaOctaviaTour/Photo-0019.jpg" />
и сам "image.php"
<?php
header('content-type: image/jpeg');
$source = $_GET['src'];
$dir = substr($source, 0, strrpos($source, '/'));
$filename = substr($source, strrpos($source, '/') + 1);
$thumb_source = $dir . '/thumbs/thumb_' . $filename;
$thumb_exists = file_exists($thumb_img);
$img_source = $thumb_exists ? $thumb_source : $source;
$dest = null;
$image = null;
$image_out = null;
$save_path = '';
$path_info = pathinfo($source);
switch($path_info['extension'])
{
case 'jpg':
case 'jpeg':
$image = imagecreatefromjpeg($img_source);
break;
case 'png':
$image = imagecreatefrompng($img_source);
break;
case 'gif':
$image = imagecreatefromgif($img_source);
break;
}
if(!$thumb_exists)
{
$width = 325;
$height = 250;
$dest = imagecreatetruecolor($width, $height);
$image_width = imagesx($image);
$image_height = imagesy($image);
imagecopyresized($dest, $image, 0, 0, 0, 0, $width, $height, $image_width, $image_height);
$image_out = $dest;
$save_path = $thumb_source;
}
switch($path_info['extension'])
{
case 'jpg':
case 'jpeg':
imagejpeg($image_out, $save_path);
break;
case 'png':
imagepng($image_out, $save_path);
break;
case 'gif':
imagegif($image_out, $save_path);
break;
}
?>
Судя по тому, что скрипт нормально создает и сохраняет тумбы в папку - я делаю вывод, что он работает.
Только вопрос, почему не выводиться изображение в браузер?
Прошу помощи.
