kproc
08-11-2007, 06:01 PM
This one has been giving me a hard time for a long while and I really need to help to get to the bottom of it.
The goal is to display the users photo if one is found and if no photo is found then show the default "blankImage" if no image was found. The below displays both the blank image and the users image if an image is found. any help with this is greatly appreciated
thank you
//Gets buddies photo from the table images if one exists
$query_get_photo = ("SELECT * FROM `image_files` WHERE `user_id` = '$buddy_id' AND `album` = 'Member'");
$get_photo = mysql_query($query_get_photo)or die("SQL Error: $query_get_photo <br>" . mysql_error());
while($photo = mysql_fetch_assoc($get_photo)){
$photoCount = mysql_num_rows($get_photo);
?>
<?php
if($photoCount > 0){
$image = "user_images/".$photo['image_name'];
$tempimg = getImageSize($image);
$size = $tempimg[3];
$size = explode("\"",$size);
$width = $size[1];
$height = $size[3];
$newwidth=75;
$newheight=($height/$width)*75;
}
?>
<img src="user_images/<?php echo $photo['image_name'];?>"width="<?php echo $newwidth; ?>" height="<?php echo $newheight?>" alt="<?php echo $photo['image_name'];?>" />
<?php }
if(empty($photo['image_name'])){ ?>
<a href="profile.php?id=<?php echo $buddy_id; ?>"><img src="user_images/blankAlbum.jpg" width="75" height="75" alt="blankAlbum.jpg" /></a><a href="profile.php?id=<?php echo $buddy_id; ?>"></a><?php } ?>
The goal is to display the users photo if one is found and if no photo is found then show the default "blankImage" if no image was found. The below displays both the blank image and the users image if an image is found. any help with this is greatly appreciated
thank you
//Gets buddies photo from the table images if one exists
$query_get_photo = ("SELECT * FROM `image_files` WHERE `user_id` = '$buddy_id' AND `album` = 'Member'");
$get_photo = mysql_query($query_get_photo)or die("SQL Error: $query_get_photo <br>" . mysql_error());
while($photo = mysql_fetch_assoc($get_photo)){
$photoCount = mysql_num_rows($get_photo);
?>
<?php
if($photoCount > 0){
$image = "user_images/".$photo['image_name'];
$tempimg = getImageSize($image);
$size = $tempimg[3];
$size = explode("\"",$size);
$width = $size[1];
$height = $size[3];
$newwidth=75;
$newheight=($height/$width)*75;
}
?>
<img src="user_images/<?php echo $photo['image_name'];?>"width="<?php echo $newwidth; ?>" height="<?php echo $newheight?>" alt="<?php echo $photo['image_name'];?>" />
<?php }
if(empty($photo['image_name'])){ ?>
<a href="profile.php?id=<?php echo $buddy_id; ?>"><img src="user_images/blankAlbum.jpg" width="75" height="75" alt="blankAlbum.jpg" /></a><a href="profile.php?id=<?php echo $buddy_id; ?>"></a><?php } ?>