HI, I don't know if this will help but I have a simlar php page in my project and I get a defaul image with the if statement like this:
if(!empty($pict_url))
Try changing you if statement from
if ($pict_url != "")
to the above if statement. It it doesn't wor4k let me know and I will try to figure something out.
PomonaGrange
Junior Poster in Training
67 posts since Jun 2008
Reputation Points: 10
Solved Threads: 3
Maybe you should switch the script around alittle. Try the following.
<?
$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 != "") {
$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>";
}
else {
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>";
}
?>
I think maybe you were telling the script to do things backwards. I have caught myself on this several times. I hope this might help.
PomonaGrange
Junior Poster in Training
67 posts since Jun 2008
Reputation Points: 10
Solved Threads: 3
Yeh I know I'm glad these forums exist too. I'm sorry that I couldn't be of more help.
PomonaGrange
Junior Poster in Training
67 posts since Jun 2008
Reputation Points: 10
Solved Threads: 3