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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.