jasonhardwick Posted May 8, 2008 Share Posted May 8, 2008 My code isn't giving me any errors but dosent display my image at all... not sure why <?php $img_path = "file/".$rows ['file']; $image_t = getimagesize($img_path); imageResize($image_t[0], $image_t[1], 600); ?> <?php function imageResize($width, $height, $target) { if ($width > $height) { $percentage = ($target / $width); } else { $percentage = ($target / $height); } $width = round($width * $percentage); $height = round($height * $percentage); return "width=\"$width\" height=\"$height\""; } ?> Link to comment https://forums.phpfreaks.com/topic/104763-image-resize-not-working/ Share on other sites More sharing options...
DarkWater Posted May 8, 2008 Share Posted May 8, 2008 Uhh, where are you actually echoing the <img> tags.....? *Is tired of problems like this* Link to comment https://forums.phpfreaks.com/topic/104763-image-resize-not-working/#findComment-536282 Share on other sites More sharing options...
BlueSkyIS Posted May 8, 2008 Share Posted May 8, 2008 you call the function imageResize, which returns part of an img tag. but you never echo anything or perform any action on any image. thus no output or anything. Link to comment https://forums.phpfreaks.com/topic/104763-image-resize-not-working/#findComment-536283 Share on other sites More sharing options...
wildteen88 Posted May 8, 2008 Share Posted May 8, 2008 Your code wont output anything as you're not telling it to. All you're doing is passing the width and height of the uploaded file to your imageResize function. imageResize then returns the a string defining the new width/height. Link to comment https://forums.phpfreaks.com/topic/104763-image-resize-not-working/#findComment-536285 Share on other sites More sharing options...
jasonhardwick Posted May 9, 2008 Author Share Posted May 9, 2008 Sorry here is the code with the echo... but still no luck. <?php $img_path = "file/".$rows ['file']; $image_t = getimagesize($img_path); imageResize($image_t[0], $image_t[1], 600); ?> <?php function imageResize($width, $height, $target) { if ($width > $height) { $percentage = ($target / $width); } else { $percentage = ($target / $height); } $width = round($width * $percentage); $height = round($height * $percentage); return "width=\"$width\" height=\"$height\""; } echo $row["$image_t"]; ?> Link to comment https://forums.phpfreaks.com/topic/104763-image-resize-not-working/#findComment-536487 Share on other sites More sharing options...
wildteen88 Posted May 9, 2008 Share Posted May 9, 2008 Your code still makes not sense. $image_t holds an array which holds the width and height for the image in $img_path Link to comment https://forums.phpfreaks.com/topic/104763-image-resize-not-working/#findComment-536995 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.