folderblog
What is folderblog?
Folderblog is a free PHP script that automatically displays the images placed in a given directory, no database needed. It can be used as a blog or gallery — and anything in between.

» demo blog   » learn more   » download now

Discussion
entirely clean url's?(back to index)
hi, is there any way to make folderblog make url's that are like this:

www.mysite.com/image/1

instead of this;

www.mysite.com/index.php/image/1

thanks in advance!
posted by G on 24 Dec 05 at 10:00 AM
I would suggest something like .htaccess coding... google for it
posted by ikue on 24 Dec 05 at 8:25 PM
ok. thank you.
posted by G on 25 Dec 05 at 4:43 AM
i have no idea to do this. anyone who can help me? :-/
posted by G on 25 Dec 05 at 4:48 AM
hmm... 'd like this too...
one thing i found out today:
the words "image" and "archive" can easily be changed by changing their appearance in the folderblog.php (for example im doing a site for a musician, where folderblogs intention - showing images - is only needed for a single image per category, the album-cover) so i changed image into release...

just as hint: in order to rewrite your urls (eg to cut out the index.php or whatever you call it) you _must_ have mod_rewrite installed (google for this term) else you'll have no luck with this.
check your phpinfo to see if it is installed on your server. i see no other solutions (without mod_rewrite). would you post if u are successful, else just ask again, i could look for a few links on this within the deeps of my bookmarks...
good luck.
posted by erik on 25 Dec 05 at 2:53 PM
i also guess one should prefer to set folderblog to work with the "traditional" parameters instead the "nearly speaking urls" before or when trying to use mod_rewrite.
i'll let you know
posted by erik on 26 Dec 05 at 4:03 AM
ok, i think i understand what mod_rewrite is now. but how do i know if it's installed on my server? do i ask my host?

i'm getting my own domain soon, so maybe i should wait 'til then ...

thanks for answering!
posted by G on 26 Dec 05 at 5:33 AM
by the way, the preview folderblog (http://folderblog.org/preview/) has these "clean url's" that i'm talking about. is this something in the making or is it just for the preview?
posted by G on 26 Dec 05 at 6:11 AM
ohhh, thats confusing. so it should work. not sure how donald coped with the problems of rewriting...
maybe he posted this earlier, or tells us soon?
for the moment you can check if mod_rewrite is running by writing a short php file. phpinfo(); is the only content you need plus <?php at the beginnig and ?> at the end. then u call it in your browser and read...
posted by erik on 26 Dec 05 at 6:26 PM
watch this: http://photos.tetto.org/ donald even got his urls "more clean" ;-) excited... hopefully he tells :)
posted by erik on 26 Dec 05 at 6:32 PM
hey! that's exactly how i want it. who is this donald anyway? :-)

thanks a LOT for the tip you gave me, i have now checked the phpinfo and it says Loaded Modules: [...] mod_access mod_rewrite and so on ... so i guess this means that mod_rewrite is enabled?

the question is; where do i go from here?
i would be more than glad if you have the time and will to help me out. :-)
posted by G on 27 Dec 05 at 9:13 AM
I am not too deep into this issue right now, but I suggest two things:

1) for avoiding http://yourdomain/fb.php, simply rename fb.php into index.php. It might be that this also requires minor changes in fb, you should just try it.

2) you create in the appropriate main directory a file called .htaccess with a content like

RewriteEngine on
RewriteRule ^([a-zA-Z0-9./_=+-]*),([a-zA-Z0-9./_=+-]*) index.php/$1

I am almost sure the line above doesnt work on the first attempt, as I didnt test it, but it should show you the way to do it.
posted by ikue on 27 Dec 05 at 10:25 AM
i get this:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, pyakex@iskall.nu and inform them of the time the error occurred, and anything you might have done that may have caused the error.
posted by G on 27 Dec 05 at 1:12 PM
i hope i didn't do anything bad.

already tried 1), but right now i am using the alternative url's which makes the url's something like www.mysite.com/?p=image/1/

at least that's someting. :-)
posted by G on 27 Dec 05 at 1:13 PM
As I said before, I didnt test that code. You should look out in Google for descriptions of how to use the Rewrite rules. It sounds like the parameter, or rather the format, is not correct.
posted by ikue on 27 Dec 05 at 4:26 PM
allright.
but as i said, i'll wait until i get my own domain and hosting. then i can experiment.

one more question: how do i do if i want to make the thumbnails generate so that they become a certain width or height? for instance if i want them all to be 100px wide max. the height doesn't matter.
i have a feeling it has something to do with the "function createThumb" in the fb.php (or index.php).

anyone who knows?

G

posted by G on 29 Dec 05 at 2:32 PM
this is a setting from a file named, guess what: fb_settings.php
(thumb-max-size and the optional square-thumbs)
regards ;-)
posted by erik on 29 Dec 05 at 4:20 PM
no, you're not following me.

i want the thumbnails to be 100px in width all the time.
if you make the setting you're talking about, it can also mean that the thumbnail can be 100px in height. i don't want that :-)
now you get me?
posted by G on 29 Dec 05 at 4:28 PM
so you are talking about landscapes // and or vertical images being cropped. hmm. so: if you select both: 100px as max-width and square-thumbs then you get what you want. (just that vertical-longer aresbeing cropped - but they ARE 100px wide. each.)
posted by erik on 29 Dec 05 at 4:43 PM
there's no such thing as a max-width option, that's what i'm trying to tell you. :-)
when you choose "100px maximum", the thumb can be either 100px in width or 100px in height.

i need it to be 100px _only_ in width.
posted by G on 30 Dec 05 at 4:07 PM
pfft.... ok, master-question: what width does a 100px x 100px image have? :-P
just do some coding see the image functions on php.net
and just for the case you think into that direction: NO, i dont know how to do that
0:-)
regards erik
posted by erik on 30 Dec 05 at 4:34 PM
ps: what about clean urls? som1 coped with that?
posted by erik on 30 Dec 05 at 4:34 PM
of course; 100px! but that is just partly the thing!
oh, i am never going to be able to explain. :-|

no, no one did that. but it doesn't matter now, i'll deal with that later when i have my own domain. :-)
posted by G on 30 Dec 05 at 5:46 PM
Okay, coming closer to clean urls. First of all you need to set $use_alternate_urls=1 in fb_settings.php. Then I've put this .htaccess file in my folderblog-root:

----snippet----
RewriteEngine On
RewriteBase /fb316/
RewriteRule ^image\/(.*)\/?$ index.php?p=image/$1
RewriteRule ^post\/image/(.*)\/?$ index.php?p=post/image/$1
----snippet---------

I could now point to an address like:

http://www.jowra.de/fb316/image/pearls/

fb316 is the root-dir and it works this way. For comments to work (at least in my case - since im not using a comment-popup in almanac) you need to change line 20 in fb.php from:

$path[0] = $fbfile = str_replace($path[1], "", $_SERVER["REQUEST_URI"]) . (isset($_GET["p"]) ? "" : "?p=");

to:

$path[0] = $fbfile = str_replace($path[1], "", $_SERVER["REQUEST_URI"]) . (isset($_GET["p"]) ? "" : "index.php?p=");

so far it works great. One problem left: when you're at the first image, that is http://jowra.de/fb316/ the link to the previous image provided is still called: index.php?p=blabla. That means you can call the shot-urls without problems but if you just clickin' through the photos you still see the index.php?p= phrase. But I#M working on that...
posted by Jowra on 31 Dec 05 at 10:40 AM
I think I worked it out:

line 20 in fb.php (or index.php) should look like this:

$path[0] = $fbfile = str_replace($path[1], "", $_SERVER["REQUEST_URI"]) . (isset($_GET["p"]) ? "" : "");

an at the lines 268-272 you should set the chmod-values to 0766.

And this is the final result for now:

http://www.jowra.de/fb316/

---

Still trying to remove the "/image/" in the url, but for the moment its quite okay. =)

posted by Jowra on 31 Dec 05 at 11:14 AM
I must change some thing in the almanac-theme and will provide the revised verson in the next few days.

Happy new year!

John
posted by Jowra on 31 Dec 05 at 11:21 AM
in order to remove the /image/ i guess that the needed info sure has to be placed within htaccess directly, no? (doesnt wordpress do it this way?) wherefrom shall the server know, that a directory-like-url isnt a directory?
posted by erik on 31 Dec 05 at 5:50 PM
I guess you're right on this one erik, but so far I don't know anything about mod_rewriting and this ends up in an endless trial & error session. :D
posted by Jowra on 1 Jan 06 at 11:08 AM
Got this thing working finally.

http://www.jowra.de/fb316/

After hacking my own .htaccess together, I just found (and remembered) an old posting of Donald (a search-function would become handy here ;-) ).

http://folderblog.org/discussion/502/

------------

# Start folderblog redirecting
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_URI} !/$
RewriteRule ^.*$ %{REQUEST_URI}/ [R,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d [OR]
RewriteCond %{REQUEST_FILENAME} /preview$
RewriteRule ^(.*)$ fb.php?p=$1
#End

--------------------

where /preview is your folderblog root-directory and in the case that you've renamed the fb.php (e.g. to index.php) just change it in the .htaccess file. These modifications results in a format like this:

domain.com/folderblog/image/name

Hence I would like to have really short URLs and my almanac-theme isn't doing categories (maybe that will change someday), I've modified the fb.php to achive even short urls without /image/ I'm not shure for now if that could be done with pure mod_rewriting but I will try it.
posted by Jowra on 3 Jan 06 at 4:45 PM
hiya guys! i've forgotten to thank you for being so helpful. i've just gotten my own domain and i'm excited to try out all these suggestions. i will tell you later how it goes.

thank you!

G
posted by G on 19 Jan 06 at 11:32 AM
hi again!

my site is up and running now (http://chamoun.se/diary), and thanks to jowra and others, the clean url is working. woho! thank you.
posted by G on 27 Jan 06 at 3:04 PM
Okay, I'm resuscitating this thread. :-)

I'm starting my photoblog over again from scratch, and I'm trying to get rid of the "/image/" part of the URL. I know how to do the rest (short URL's by .htaccess) but it's the "/image/" part that I really really want to cut out.
I've noticed Jowra somehow has succeeded with this on his photosite, would you care to tell me how you did it? :-)
posted by George on 18 Jun 06 at 2:12 PM
Post a Reply:

Name:    Remember me
URL:    
(include http:// or mailto:)
(back to index)