casperboy77 Posted November 25, 2006 Share Posted November 25, 2006 Hello I am using a free picture gallery software from: [url=http://www.saurdo.com/?p=75]http://www.saurdo.com/?p=75[/url] How it works is it just looks into the folders and displays the images in the folder in a gallery. For the Gallery topics it uses the original folders name. Most of the gallery works fine even with the spaces in the folders name. When you click on an image that is in a gallery if it is in a folder with spaces in the name it will display just fine. But when that picture is open there are options under the picture one of the options is "Full sized". If you click on that and lets say the folders name is: "These are cool", then it attempts to open a folder named "These" which results in an error. It seems like once there is a space it only uses the first word in the folder's name. I'm not too good with php so any help is appreciated. Below is the code that I think is the problem:echo '<a href="./gallery/img.php?file='.$currentdir.$img.'&thumb=0" class="linkopacity" rel="lightbox['.$currentdir.']" title="View Preview" id="<ul><li>Full sized - <a href='.$gallery_address.$currentdir.$img.' target=_blank>'.$img.'</a></li><li><a href='.$_SERVER['PHP_SELF'].'?file='.$currentdir.$img.' target=_blank>Detailed information</a></li></ul>"><img src="./gallery/img.php?file='.$currentdir.$img.'&thumb=1"></a>';If that isn't the code then the above link to the program will let you download it for free. It is a very small script and very few files. ----------------------------Ok that was my first question. Here is my second question:When you click on an image in the gallery you get two options that appear below the picture that pop's up. One for "Full sized" and the other is: "Detailed Information" Detailed Information uses Exif data (whatever that is), my hosting server doesn't have that so this option doesn't work. There are instructions in the supplied readme to delete the Detailed Information link if you don't have a working Exif. Anyways I don't want to delete it. This is what I would like to do: I want to make a text file that has the same name as the picture (ex. image1.jpg, image1.txt), In the text file I want to custom type my own discription and have it display when the person clicks on "Detailed Information". Lastly if a particular image doesn't have a text file with it I would like it to either say: No Information available, or simply not display the "Detailed Information" link. Again I don't have much knowledge of php at all. Any help is so greatly appreciated. Thanks in advance!-Jim Link to comment https://forums.phpfreaks.com/topic/28407-getting-php-to-understand-spaces-in-folder-name/ Share on other sites More sharing options...
The Little Guy Posted November 25, 2006 Share Posted November 25, 2006 str_replace(" ","%20", $value)Try something like this (Just an example you may need to change):[code]<?phpecho '<a href="./gallery/img.php?file='.str_replace(" ","%20", $currentdir).str_replace(" ","%20", $img).'&thumb=0" class="linkopacity" rel="lightbox['.$currentdir.']" title="View Preview" id="<ul><li>Full sized - <a href='.str_replace(" ","%20", $gallery_address).str_replace(" ","%20", $currentdir).str_replace(" ","%20", $img).' target=_blank>'.$img.'</li><li><a href='.$_SERVER['PHP_SELF'].'?file='.str_replace(" ","%20", $currentdir).str_replace(" ","%20", $img).' target=_blank>Detailed information</li></ul>"><img src="./gallery/img.php?file='.str_replace(" ","%20", $currentdir).str_replace(" ","%20", $img).'&thumb=1">';?>[/code] Link to comment https://forums.phpfreaks.com/topic/28407-getting-php-to-understand-spaces-in-folder-name/#findComment-129956 Share on other sites More sharing options...
heckenschutze Posted November 25, 2006 Share Posted November 25, 2006 [quote author=The Little Guy link=topic=116234.msg473468#msg473468 date=1164441748]str_replace(" ","%20", $value)Try something like this (Just an example you may need to change):[code]<?phpecho '<a href="./gallery/img.php?file='.str_replace(" ","%20", $currentdir).str_replace(" ","%20", $img).'&thumb=0" class="linkopacity" rel="lightbox['.$currentdir.']" title="View Preview" id="<ul><li>Full sized - <a href='.str_replace(" ","%20", $gallery_address).str_replace(" ","%20", $currentdir).str_replace(" ","%20", $img).' target=_blank>'.$img.'</li><li><a href='.$_SERVER['PHP_SELF'].'?file='.str_replace(" ","%20", $currentdir).str_replace(" ","%20", $img).' target=_blank>Detailed information</li></ul>"><img src="./gallery/img.php?file='.str_replace(" ","%20", $currentdir).str_replace(" ","%20", $img).'&thumb=1">';?>[/code][/quote]It's up to the browser to do that, Most browsers will infact escape %20 (rather than interpreting it as a space), so you'll just end up with %20 in your query string ?file=. Link to comment https://forums.phpfreaks.com/topic/28407-getting-php-to-understand-spaces-in-folder-name/#findComment-129973 Share on other sites More sharing options...
The Little Guy Posted November 25, 2006 Share Posted November 25, 2006 that isn't a query, It is just building the link, and this will help the link work better, and be a valid link. Link to comment https://forums.phpfreaks.com/topic/28407-getting-php-to-understand-spaces-in-folder-name/#findComment-129976 Share on other sites More sharing options...
casperboy77 Posted November 25, 2006 Author Share Posted November 25, 2006 Little Guy,Thanks that worked! Any ideas for the second part of my original question? Thanks so much, that corrected the first problem for me.-Jim Link to comment https://forums.phpfreaks.com/topic/28407-getting-php-to-understand-spaces-in-folder-name/#findComment-130141 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.