[SOLVED] getimagesize() question
Posted: Tue Jun 13, 2006 10:01 am
I'm using getimagesize() to try and contrain an image uploaded by users.
Some use spaces in filename (eg: John Hughes Picture.jpg) which throws the code off,
but sometimes, even when the name is properly (eg: seasons_chris_full.jpg) the resize doesn't work...
For example, the constraints shouldn't allow an image to be wider or taller than 125px,
however, there is an image displaying as (72dpi) 1500 x 2100px...
Some use spaces in filename (eg: John Hughes Picture.jpg) which throws the code off,
but sometimes, even when the name is properly (eg: seasons_chris_full.jpg) the resize doesn't work...
For example, the constraints shouldn't allow an image to be wider or taller than 125px,
however, there is an image displaying as (72dpi) 1500 x 2100px...
Code: Select all
$ID = $memberresults[Mem_ID];
$ceo = $memberresults[Mem_CImage];
$image = "http://www.advantageboard.com/Imi/Mem_Img/$ID/$ceo";
if ($ceo == "none") {
}
else {
$size = getimagesize("$image");
}
$height = $size[1];
$width = $size[1];
if ($width > 125)
{
$width = 125;
$percent = ($size[1] / $height);
$width = ($size[0] / $percent);
}
else if ($width > 125)
{
$width = 125;
$percent = ($size[0] / $width);
$height = ($size[1] / $percent);
}
$imageCEO=$memberresults["Mem_CImage"];
if(empty($imageCEO) || $imageCEO =="none" ){
echo "";
}
else {
echo "<img src='$image' height='$height' align='left' width='$width' border='0' vspace='2' hspace='2' class='caltable'>";
}