Forum Moderators: coopster

Message Too Old, No Replies

getimagesize

Not generating error and no results!

         

henry0

6:13 pm on Jul 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello
this is mind bugging
the resize does not generate error and does no action!
sorry for the code posting (although it is a short one)
but I need to display it
thank you

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);

?>

jatar_k

6:21 pm on Jul 18, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



have you tried echo'ing the height and width after getimagesize is called? Is there anything in there?

Why do you have caps in the function names? I am not sure if that matters, I would think it would but maybe not.

henry0

6:41 pm on Jul 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



HEllo Jatar_K

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

henry0

6:48 pm on Jul 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Removing cap did not change anything

interesting
I commented the include resize_image
and renamed the resize_image file on the server in order to assure that it will not be found

well the img are still loading
not even creating an error
everything regarding that file acts like it was a shadow file!