. */ // call: photo.php?id=$id include("./../include/mysql.php"); include("./../include/functions.php"); $query="SELECT `FirstName`, `LastName`, `photo` FROM `persons` WHERE `PersonID`=".addslashes(get_int('id')); if( @mysql_num_rows( $res=doquery($query) )==1 ) { $row=mysql_fetch_array($res); if( strlen($row['photo'])>0 ) { header("Content-type: image/jpeg"); header("Content-disposition: inline; filename=\"Photo ".$row['FirstName']." ".$row['LastName'].".jpg\""); echo $row['photo']; }else { header("Content-type: image/png"); $im = ImageCreate(120, 50); $background_color = ImageColorAllocate($im, 104, 103, 222); $text_color = ImageColorAllocate($im, 242, 186, 47); ImageString($im, 2, 5, 5, "No photo available", $text_color); ImageString($im, 2, 5, 20, "for this person", $text_color); ImagePNG($im); ImageDestroy($im); } mysql_free_result($res); }else { // No photo found, show error picture header("Content-type: image/png"); $im = ImageCreate(120, 50); $background_color = ImageColorAllocate($im, 104, 103, 222); $text_color = ImageColorAllocate($im, 242, 186, 47); ImageString($im, 2, 5, 5, "Unknown id (".$id.")", $text_color); ImagePNG($im); ImageDestroy($im); } ?>