Hi all!
I have problem, with image. On SQL server I have for example story with image.jpg or what I like and I can not get this image in front page🙂)
in way what I like.
Actualy I want use for example one or more images for front page from story. How does it work this PHP script.
in the front page
// I have link to story
if ($story[picture])
print "<IMG SRC=\"resize_image.php?image=$story[picture]\">";
//end
in the story image.jpg is ok
but if I use this resize_image.php image can not find size and type🙁((
ok
//there is a resize_image.php
<?php
if (!$max_width)
$max_width = 0;
if (!$max_height)
$max_height = 1;
$size = GetImageSizeJpeg($image);
$width = $size[0];
$height = $size[1];
$x_ratio = $max_width / $width;
$y_ratio = $max_height / $height;
if ( ($width <= $max_width) && ($height <= $max_height) ) {
$tn_width = $width;
$tn_height = $height;
}
else if (($x_ratio $height) < $max_height) {
$tn_height = ceil($x_ratio $height);
$tn_width = $max_width;
}
else {
$tn_width = ceil($y_ratio * $width);
$tn_height = $max_height;
}
$src = ImageCreateFromJpeg($image);
$dst = ImageCreate($tn_width,$tn_height);
ImageCopyResized($dst, $src, 0, 0, 0, 0, $tn_width,$tn_height,$width,$height);
header("Content-type: picture/jpeg");
ImageJpeg($dst, null, 10);
ImageDestroy($src);
ImageDestroy($dst);
?>
//end