proctk Posted July 19, 2007 Share Posted July 19, 2007 The below code sets the size the image should be displayed. The problem is sometimes the value $row['image_name'] could be blank. when its blank i get this error message Warning: getimagesize() [function.getimagesize]: Read error! in /mnt/w0400/d11/s01/b02a5c57/www/familyclick.ca/photos/photos.php on line 114 thats because $row['image_name'] is blank. any ideas how to over come this the below is not working if(!$row['image_name'] = ""){ $image = "../user_images/".$row['image_name']; $tempimg = getImageSize($image); $size = $tempimg[3]; $size = explode("\"",$size); $width = $size[1]; $height = $size[3]; $newwidth=100; $newheight=($height/$width)*100; } if($row['image_name'] = ""){ $newwidth=100; $newheight=90; } Link to comment https://forums.phpfreaks.com/topic/60704-skip-over-code/ Share on other sites More sharing options...
AndyB Posted July 19, 2007 Share Posted July 19, 2007 if(!$row['image_name'] = ""){ should be if(!$row['image_name'] == ""){ ... both places = is the assignment operator == is the equality operator - http://ca.php.net/manual/en/language.operators.comparison.php Link to comment https://forums.phpfreaks.com/topic/60704-skip-over-code/#findComment-301999 Share on other sites More sharing options...
proctk Posted July 19, 2007 Author Share Posted July 19, 2007 don't I feel stupid. I'm thinking that I should go to bed Link to comment https://forums.phpfreaks.com/topic/60704-skip-over-code/#findComment-302002 Share on other sites More sharing options...
Caesar Posted July 19, 2007 Share Posted July 19, 2007 Yep, look out for using '='...you need '==' when using in if statements. You can also try... <?php if(trim($row['image_name']) != ''){ $image = "../user_images/".$row['image_name']; $tempimg = getImageSize($image); $size = $tempimg[3]; $size = explode("\"",$size); $width = $size[1]; $height = $size[3]; $newwidth=100; $newheight=($height/$width)*100; } ?> Link to comment https://forums.phpfreaks.com/topic/60704-skip-over-code/#findComment-302003 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.