I get an array of image URL by php scanning image folders. Some of the image file names have white space. The part after white space got lost. for example:
This file is fine:
http://domain.com/folder/blue-sky.png
This file will lost the part sky.png
http://domain.com/folder/blue sky.png
My code for scanning the folder has nothing to do with checking or manipulating file names. How can I get the full name of blue sky.png without rename it to blue-sky.png?
Space in url encoding are represented with the string “%20”
so you may want to use str_replace to replace every instance of the ” ” character to the character “%20”
will output
Complementary information
Also, I never used it myself, but I would take a look at the php function urlencode if I were you, it may contains useful information
Note : Url encode will transform every characters that is not standard of the string (so you may want to only use urlencode on the string that is your image name)