[Crying] php output image problem is killing me

little confused. can you clarify

profile/paul k 23445667788744.jpg is what is output from your database? So what should the correct filename look like? Full path (excluding domain)

the advice about escaping the whitespace above is probably pointless.
your browser will do this automatically. eg click here

as you say this works on another page but not on this one then that implies its the code thats wrong not how its stored in the db

It does sound like a relative url problem. How does the full path to the jpg compare to the one echo'd from the db?
Test it - Add another line to your code to echo a <a> tag with your db url as the href. Then click it see what you get and how that compares with what it should be.


Thanks.

Without my domain name, the path to image is
public_html/profile/paul k 23445667788744.jpg

In the database, image is stored as
profile/paul k 23445667788744.jpg

Using chromo to inspect the element, img src is
paul k 23445667788744.jpg

It does seem having a broken image is uncalled for.

When I output a <a> it seem okay to.
 
Thanks.

Without my domain name, the path to image is
public_html/profile/paul k 23445667788744.jpg

In the database, image is stored as
profile/paul k 23445667788744.jpg

Using chromo to inspect the element, img src is
paul k 23445667788744.jpg

It does seem having a broken image is uncalled for.

When I output a <a> it seem okay to.

So when you click the link created by your test <a> you end up on the correct image?
When you inspect the element it is missing the "profile/" part?
The php page is in the same directory as "profile"?

@soccerlover might be onto something above but I wonder is it a tab not space you need to replace. But that doesnt explain how the code works on one page but not another.

All blind guess work though - if you feel like it PM an example url where its broken and one where it works and i'll have a look. Or at the least check them yourself and compare the two src parameters.
 
Hi Jangga,

I hope this will solve your issue, in case if your problem isn't solved yet..

Use the following image tag instead of your's.

Code:
<img src=\"http://www.domain.com/". $register["image"] ."\" border=\"0\" width=\"300\" height=\"200\" />

If the above doesn't work use str_replace function to replace with '%20' instead of ' ' (blank space).

Code:
<img src=\"http://www.domain.com/". str_replace(' ', '%20', $register["image"] )."\" border=\"0\" width=\"300\" height=\"200\" />
 
Back
Top