Jump to content

[SOLVED] Strange problem when displaying PHP generated image (Firefox 2.0.0.11)


Seidr

Recommended Posts

Greetings, I've been re-designing my site and have come across a strange problem involving the display of images, generated from a PHP script in FireFox. Upon loading the url http://new.othala.co.uk/2/5 for the first time, the image ('Cellular') will load correctly with a forced max width of 800px. The image is created by PHP, opening a JPG file on the server-side, and outputting it through GD. Now when I hit reload, or navigate away from the page and return, all that is displayed is the ALT text, even though the definition of the image is valid, and the image will load when visited directly (http://new.othala.co.uk/image/5). This feels like a cache issue, but surely the cache would not cause the image to not display at all?

 

If anyone can think what may be causing this strange error, your help would be appreciated. The only way I found to display the image was by appending a random digit to the request each time. While a solution to the problem, it would not be very friendly towards search engines, and I'm trying to keep this site as tidy as possible.

 

I'm using mod_rewrite to redirect the request to my PHP script. Below is the rewrite rule, and the image script.

 

RewriteRule ^image/([0-9^/\.]+)/?$ /includes/image.php?id=$1&full=1 [L]

 

<?php
include("DATABASEFILE");

$query = "SELECT * FROM <TABLE REMOVED> WHERE id=" . $_GET['id'];
$results = mysql_query($query);

$resultsArray = mysql_fetch_array($results);

if (!$_GET['full']) {
	$path = "<PATH REMOVED>/tn_" . $resultsArray['filename'];
} else {
	$path = "<PATH REMOVED>/" . $resultsArray['filename'];
}

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

$img = imagecreatefromjpeg($path);
imagejpeg($img);

?>

 

Many thanks!

James

Link to comment
Share on other sites

It displays for me too, the version of firefox shouldn't be that big a deal.

Did you accidentally block it in IE? Does it show in IE, Opera or Safari?

 

The only way I have ever been able to do it is with appending the timestamp to the end.

Link to comment
Share on other sites

It displays for me too, the version of firefox shouldn't be that big a deal.

Did you accidentally block it in IE? Does it show in IE, Opera or Safari?

 

The only way I have ever been able to do it is with appending the timestamp to the end.

 

It works fien in IE, have not tried in Opera or Safari. It loads fine the first time I visit the page, but as I said as soon as I reload or refresh, all that is shown is the ALT tag. Perhaps FF needs to be reinstalled..unlikely, but I have no idea what else could be causing it!

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.