|
I am using following fucntion to get proportionate width for user specific height
However I noticed that in case image name is having space it gives an error
Example Function works ok for image name say "pict1.jpg"
However gives error for
pict 1.jpg (space in name beforer 1)
list($width, $height, $type, $attr) = getimagesize(addslashes($imagename));
if ($width ==0)
{$imgstr="No Image"; }
else
{
$h=$height*($reqwidth/$width) ;
if ($width > $reqwidth)
{ $imgstr="<img src='".addslashes($imagename)."' width=".$reqwidth." height=".$h." border=0 >";}
else
{ $imgstr="<img src='".addslashes($imagename)."' width=".$width." height=".$height." border=0 >";}
}
return $imgstr;
}
|