Jump to content

image not displaying


Distant_storm

Recommended Posts

I am using a script that reads the image file and then displays it...

 


if (!isset($_GET['pho']) || !ctype_digit($_GET['pho'])) {

header("Content-type: image/jpeg");

$im = imagecreatefromjpeg("No_image_display.jpeg");
imagejpeg($im);

imagedestroy($im);

} else {

$photo_id=$_GET['pho'];

if ($dbc = @mysql_connect('lllllll','nnnnn','kkkkkk')) {

if (@mysql_select_db('kazphotos')) {

$photo_id= mysql_real_escape_string($photo_id);

$query="SELECT * FROM photos WHERE Photo_id='$photo_id'";

if ($r= mysql_query ($query)) {
while ($row = mysql_fetch_array($r)) {


$photo_path="XXXXXXX/XXXXXX/" . $row['Photo'];
}
}


}
}


header("Content-type: image/jpeg");

$handle = @fopen($photo_path,'r');

      while(!feof($handle)) {
           echo fread($handle, 9000); 
      }







}

 

 

however a page uses this script to call multiple images one by one uusing

<img src=image.ph?pho=3>

 

Yet sometimes somewhat random photos don't display, why woudl this be ?

Link to comment
https://forums.phpfreaks.com/topic/83870-image-not-displaying/
Share on other sites

What are the names of the photo's you are trying to display?  What are the differences between the ones that do display, and the ones that don't?

 

Most likely, the ones that don't display have some sort of character that is being "urlized" (space = "%20", etc.).  Use urldecode to remove the characters that are being changed.

 

http://www.php.net/urldecode

Link to comment
https://forums.phpfreaks.com/topic/83870-image-not-displaying/#findComment-427457
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.