Hi
I have a few product feeds that have image file names with spaces in them. When I then call them from the database I cache the images if they haven't been previously downloaded, however, the images with spaces in the file names just won't display.
I've tried inserting %20 into the file name to replace the spaces but they still won't display.
If I type the URL of the image directly into the browser the images display ok as the browser automatically replaces the spaces with %20.
Any ideas please?
Regards
Jason
Hi David,
Thanks for the pointer ...
I use getimagesize to resize the images and it turns out that getimagesize doesn't accept spaces in image file names.
Used the following code and it now works a treat:
$img_src = str_replace(' ','%20',$img_src); //REPLACE THE SPACES
Many thanks
Jason
Hi Jason,
If an image URL contains a space it is important that the src attribute in the IMG tag uses quotes; otherwise the URL will become broken. Other than that there's no reason why spaces should cause a problem. The real thing to look at is the HTML that is being generated - the problem should reveal itself in the source - so if you could post a section of the HTML that is being generated when an image is not being display that will help...
Cheers!
David.