Image Display
Posted: Wed Mar 18, 2009 8:53 pm
I have a very strange thing happening on something I’m developing. I don’t know whether it’s a PHP problem or HTML or something else. It is a page for a profile of a client of the web site, which allows the client to upload a photo. I have a dummy image that’s displayed before the client uploads the image. When the client uploads the new image though, it will not display. I have verified that the image actually gets uploaded. It’s in the same directory as the dummy image. The img tag contains the same path to the new img as with the old dummy image yet the new image will not display. I’ve also verified that the database does get updated with the name of the new image. Everything seems to be as it should be, yet the image does not display. It has got me baffled!
Below is the text that handles the image display:
Does anyone have any idea what I’m running into?

denewey
Below is the text that handles the image display:
Code: Select all
<?php
$photo_display = "<img src='/photos/";
$get_photo = mysql_query("SELECT photo FROM client_profile WHERE client_id = '{$cid}'");
list ($photo) = mysql_fetch_row($get_photo);
if($photo != "")
{
$cphoto = "photos/{$photo}";
$img_size = getimagesize($cphoto);
$adjust = $img_size[0]/100;
$wide = $img_size[0]/$adjust;
$wpos = strpos($wide, ".");
if($wpos !== false)
{
$wide = substr_replace($wide, "", $wpos);
}
$high = $img_size[1]/$adjust;
$hpos = strpos($high, ".");
if ($hpos !== false)
{
$high = substr_replace($high, "", $hpos);
}
$photo_display .= "{$photo}' width='{$wide}' height='{$high}' />"; //THIS ONE DOESN’T DISPLAY
}
else
{
$photo_display .= "blank_head.jpg' />"; // THIS ONE DISPLAYS ON THE PAGE
}
echo $photo_display;
?>
denewey