Hi,
I have spent hundreds of hours fixing errors with my phpauction GPL V2.51 script I bought. A lot have been cosmetic but this one is causing onscreen errors and making the page extremely slow to load.
To cut a long story short, if the thumbnail image a customer is linking to or has uploaded is not available for some reason, I get a "Division by Zero" error involving the file thumbimage.php
I have tried to fix it with no success. The database (I assume) knows what to look for and if it isn't there I get the onscreen errors.
Is there a way to get it to display the default "noimage.gif" picture instead of just spitting the dummy? I thought the coding did that at the bottom, but it doesn't.
This is extremely annoying because if, say a seller's Photobucket goes down - so does my website!
Here is the file code:
<?
$pict_url = mysql_result($result, $i, "pict_url");
$pict = "uploaded/$pict_url";
$phu = intval(mysql_result( $result,$i,"photo_uploaded") &&($pict_url!=''));
if ($pict_url != "") {
if ( $phu) {$pict_url = $pict;
}
$f_size = @getimagesize($pict_url);
$width = $f_size[0];
$height = $f_size[1];
$x_ratio = $max / $width;
$y_ratio = $max / $height;
if (($width <= $max) && ($height <= $max)) {
$tn_width = $width;
$tn_height = $height;
}
else if (($x_ratio * $height) < $max) {
$tn_height = ceil($x_ratio * $height);
$tn_width = $max;
}
else {
$tn_width = ceil($y_ratio * $width);
$tn_height = $max;
}
$thumbnail = "<a href=\"item.php?id=$id\"><IMG SRC=\"$pict_url\" width=\"$tn_width\" height=\"$tn_height\" border=\"0\" alt=\"See more details for $title\">"."</a>";
$tplv[img] = "<a href=\"item.php?id=".$row[id]."\">"."<IMG SRC=\"$pict_url\" width=\"$tn_width\" height=\"$tn_height\" border=\"0\" alt=\"See more details for $title\">"."</a>";
$tplv .= "<a href=\"item.php?id=".$row[id]."\">"."<IMG SRC=\"$pict_url\" width=\"$tn_width\" height=\"$tn_height\" border=\"0\" alt=\"See more details for $title\">"."</a>";
}
else {
$thumbnail = "<img src=\"images/nopicture.gif\" width=75>";
$tplv[img] = "<img src=\"images/nopicture.gif\" width=75>";
$tplv .= "<img src=\"images/nopicture.gif\" width=75>";
}
?>
This is the only major problem I seem to have left and any help would be greatly appreciated.
Thanks in advance,
Graham