DIGIT-ARC read-only archive · snapshot: July 23, 2026

PHP problem with firefox

11 posts · originally from https://geek.digit.in/community/threads/php-problem-with-firefox.74149/

amitava82
amitava82 Original post #1
Nov 26, 2007 at 12:21 PM
First, here is the piece of code:
Code:
<img src="images\<?php echo $row_Recordset1['photo']; ?>" />
my images are stored in a folder called "images" and file names are stored in a database. the recoedset1 gets the image name from the database.

Now the problem is, Internet Explorer 7 is displaying the image but Firefox is NOT. I absolutely have no clue whats wrong.. When I view the source code for both IE and FF, both are same
Code:
<img src="images\383huge.jpg" />

Then why the image is not being displayed? :confused: :confused: :confused:
QwertyManiac
Nov 26, 2007 at 3:00 PM
Shouldn't the slash be the other way ( / )?

Edit: Confirmed, your slash is the mistake. IE's just being stupid.
amitava82
Nov 26, 2007 at 3:48 PM
Nope.. not working. But interesting thing I have found that FF is converting the "\" into Escape code "%5C". but why?
Code:
*gbsa.clanteam.com/images%5C9215image2.jpg
actual file name is 9215image2.jpg
QwertyManiac
Nov 26, 2007 at 4:05 PM
\ is for escaping ALWAYS isn't it? Its a common HTML error people make in mixing up the slashes.

Putting / still doesn't make it work?
amitava82
Nov 26, 2007 at 4:16 PM
Nope... Very weird..
I've worked around a temporary solution by defining two PHP variables, one with a value of "images/" and another with the image name from database then adding them in image src.. It works. But what could be the problem!
QwertyManiac
Nov 26, 2007 at 4:28 PM
Try making your function return with images/ prefixed?

(I mean, modify the echo part)

No idea, but putting a \<tag> in any string will result as &gt;tag> or something like it cause \[anything] is an escape sequence globally.
A
ashokjp #7
Nov 26, 2007 at 5:57 PM
even if the browser converts the string, the file should be able to be accessed.

where is your script located and where is the images located ?
Say this is your directory structure
xyz
-->images/
-->script.php

then you can specify the code in php script as ./images/ or images/
it should work, infact it works for me on firefox 2.0.0.9
amitava82
Nov 26, 2007 at 10:13 PM
Its a firefox bug.. Both IE and opera are working fine..
jaya
jaya #9
Nov 29, 2007 at 2:36 PM
amitava82 said:
Its a firefox bug.. Both IE and opera are working fine..

Please change your code like and test This code may be work :)
<?php
$image=$row_Recordset1['photo'];
$image_size =@getimagesize($image);
?>
<img src="images/<?php echo $image; ?>" <?php echo $image_size[3];?> />
amitava82
amitava82 #10
Nov 29, 2007 at 3:59 PM
Well, finally what I have found that this has nothing to do with PHP code. Both are fine. The problem is with file name. My test file name is "
102_1600x12001.jpg". If I upload this file, FF is not showing the image but both opera and IE are fine. Now when I remove the 'x' part of the file name everything works great. Even if i place the x anywhere in the filename say "102x_16001200.jpg" it works fine. Its so weird..
debiprasad_sahoo
Nov 29, 2007 at 5:18 PM
What QwertyManiac saying is right. The problem is with '\' (what you are using in your code). You have to use '/' in any http request path. IE is that compatible so it displays your image, but FF can't. Please change your code. Replace '\' by '/' in http path. This is not even a bug of FF.