PHP problem with firefox

Status
Not open for further replies.

amitava82

MMO Addict
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

Commander in Chief
Shouldn't the slash be the other way ( / )?

Edit: Confirmed, your slash is the mistake. IE's just being stupid.
 
Last edited:
OP
amitava82

amitava82

MMO Addict
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

Commander in Chief
\ 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?
 
OP
amitava82

amitava82

MMO Addict
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!
 
Last edited:

QwertyManiac

Commander in Chief
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.
 
Last edited:

ashokjp

Right off the assembly line
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
 

jaya

Broken In
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];?> />
 
OP
amitava82

amitava82

MMO Addict
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

Web Junky 2.0
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.
 
Status
Not open for further replies.
Top Bottom