Jump to content

skip over code


proctk

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.