If I put it too early, it says, "Headers already sent", with a parse error. If I put it in where it needs to go, it returns a bunch of random characters. HELP!!
Code: Select all
$query1 = "select * from propertyimages where property = '$propid' and `order` = '1' ";
$result1 = mysql_query($query1);
$count1 = mysql_num_rows($result1);
if($count1 == 0)
{ echo "<i>No Photo Available</i><br><br>"; }
elseif($count1 > 0)
{ header("Content-Type: image/jpeg");
$fetching = mysql_fetch_array($result1);
extract($fetching);
$add = "admin/".$imgsrc;
$width = 100;
$height = 100;
list($width_orig, $height_orig) = getimagesize($add);
$ratio_orig = $width_orig/$height_orig;
if ($width/$height > $ratio_orig) {
$width = $height*$ratio_orig;
} else {
$height = $width/$ratio_orig;
}
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($add);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
imagejpeg($image_p);
}
//
echo "</center><br>
<b>$streetaddress</b><br>$citystatezip<br><a href=\"\">See More Information</a></td>";
$row_count++;
}
echo "</table>";