# PHP problem with firefox



## amitava82 (Nov 26, 2007)

First, here is the piece of 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

```
<img src="images\383huge.jpg" />
```

Then why the image is not being displayed?


----------



## QwertyManiac (Nov 26, 2007)

Shouldn't the slash be the other way ( */* )?

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


----------



## amitava82 (Nov 26, 2007)

Nope.. not working. But interesting thing I have found that FF is converting the "\" into Escape code "%5C". but why?

```
*gbsa.clanteam.com/images%5C9215image2.jpg
```
actual file name is 9215image2.jpg


----------



## QwertyManiac (Nov 26, 2007)

*\ *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)

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)

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.


----------



## ashokjp (Nov 26, 2007)

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)

Its a firefox bug.. Both IE and opera are working fine..


----------



## jaya (Nov 29, 2007)

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 (Nov 29, 2007)

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)

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.


----------

