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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.