Forum Moderators: coopster
this calls the function as part of larger CMS that works fine, but img!
actually there is no need to call it via include since
$size calls it, but I did it out of desperation
it does not change anything - it should not -
<?php
include ("resize_image.php");
if ($s[picture]){
$size =getimagesize($s[picture]);
$width=$size[0];
$height=$size[1];
?>
this is the function (within the include :resize_image.php)
<?php
if (!$max_width)
$max_width = 250;
if (!$max_height)
$max_height = 152;
$size = GetImageSize($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: image/jpeg");
ImageJpeg($dst, null, -1);
ImageDestroy($src);
ImageDestroy($dst);
?>
when the form has submited it goes to an admin section
out of which one I can edit, del etc..
at that point the img (link) is already loaded in the db
and the index.ph file shows that it has been laoded and has been displayed (at original size)
the admin section shows also the img as is in the DB and show its original size (as from the user HDD upload)
so width and height print fine
I am on my way to remove cap
will post back
thank you