Shampoo: a simple PHP photo gallery

Shampoo is a very simple photo gallery script that doesn't require a database.

Shampoo screenshot Main page, showing all albums

The gallery is built using the existing directory structure, where thumbnails are created and stored by the script.

The HTML produced is minimalistic, semantic and template-based, so the gallery is easy to build into existing websites.

Unobtrusive JavaScript is used for progressive enhancement and can be removed entirely with no loss of functionality.

» Download (450kB) – changelog

Latest version: 0.7 (19/04/2011)

Demo (my photo gallery also uses it, of course!).

Requirements

Your server needs to run PHP 5+ and it must understand .htaccess files because mod_rewrite is used to make nice URIs. This is pretty standard and the vast majority of commercial web hosts will have no problem with this.

In order for thumbnail creation to work, your server will also need to have GD installed. Again, any host worth its salt will have GD installed.

Instructions

Shampoo screenshot Single album view

  1. Extract the archive (shampoo.zip) into a directory on your server.
  2. Make new albums by making new directories under the one where you extracted everything.
  3. Put pictures in these albums and Shampoo will take care of everything else.
  4. That's pretty much it. To see it, simply point your browser to the directory (index.php is the thing to run). For example, if you've put the gallery in the root of your domain, just go to http://www.mydomain.com/shampoo/ (or whatever you called the directory).

Admin interface

Starting with version 0.6, an admin interface is included. It is entirely dependent on JavaScript and is implemented as a "layer" of functionality on top of the gallery. It allows you to upload pictures and edit things directly in the browser thanks to the contentEditable capabilities of modern browsers.

If you use Firefox or Chrome you can upload multiple images at once, including via drag-and-drop from your computer. You can try it out in the demo.

Manual control

If you don't like the admin interface, you can still edit album descriptions, album titles and other settings directly in index.txt and settings.php (instructions within them). Naturally you can also upload pictures and videos by direct FTP upload.

To add captions manually, it's best to illustrate by example. Let's say you have an album (directory) called "lemurs" containing pictures from your holiday in Madagascar. Some of the pictures you want to add captions for are called "lemur1.png" and "myfavouritelemur.jpg". What you have to do is create a file called "lemurs.txt" (same name as the directory) and put the following in it:

lemur1.png|Who would've thought lemurs could do handstands!
myfavouritelemur.jpg|Really, out of all of them, this one was my favourite.

Hopefully you can discern a pattern from that. Blank lines in the file are ignored.

Passwords

You can lock albums so they can only be viewed with a password. Currently the admin interface is the only way to do this, they are no longer stored as strings in settings.php as they were in older versions. To set a password, open the album and click the "Add a password" link at the top.

The admin interface is also accessed via a password. When you first run the gallery, you will be asked to choose it. There on after you log in via the "Admin" link at the bottom of the page.

Embedding it in your website

Shampoo runs off a template file, shampoo.inc. You can add any PHP or HTML to it to make the gallery fit in with your website.

The CSS is all contained within shampoo.css and should not interfere with your website's existing CSS.

Video support

The gallery can display FLV and MP4 videos (i.e. video formats supported by the Flash plugin). Flowplayer is the player used, and is included with Shampoo so you don't have to do anything.

This is for video files placed in the gallery, like images are – not for displaying YouTube or Vimeo videos. Of course if you've downloaded the YouTube video as an MP4 or FLV and you've put it in your album, then that will of course work.

FFmpeg

Video thumbnail - panda.flv Alternate video thumbnail

In order to generate thumbs for each video you put in an album, FFmpeg has to be installed on your server. It will make the thumb from the first frame of the video. If FFmpeg is not present, an alternative thumbnail will be generated (see image).

If you don't have FFmpeg, it's straightforward to install if you have shell access. I followed these instructions, which should work for any host.

You might need to change the path to FFmpeg specified at the top of shampoovideo.php to the correct path on your server (I can't help with this).

License

BSD-style license. This means you can pretty much do whatever you want as long as you give due credit.

Problems?

Shampoo screenshot Single image view

Trouble viewing individual albums or image pages

This is most likely a problem with mod_rewrite and your .htaccess file (in the base directory of Shampoo).

  1. Check that mod_rewrite is enabled on your server. This can be achieved via phpinfo or by asking your host.
  2. Open .htaccess in your text editor. Try uncommenting some of the lines at the top, which may help (particularly the RewriteBase directive).

If you are using a subdomain or if you know you are using mod_alias. If your filesystem is very different to the URI structure, then it is also likely you will need to use a RewriteBase directive.

The single / is most commonly needed when RewriteBase is required, but some hosts (e.g. 1and1) might require the path too. For example, if your base directory is called "pictures":

RewriteBase /pictures

If your host supports PHP 4 and PHP 5, but it defaults to PHP4, you need this right at the top of your .htaccess (uncomment it):

AddType x-mapp-php5 .php

If any of these solutions work for you, or you have a different one, please let me know.

Images not showing

If your image filename contains non-Latin characters (e.g. Scandinavian letters like "å", "æ" and "ø") Apache may have trouble finding them, particularly on Linux (this doesn't seem to be a problem on Windows).

The solution is to simply not use those characters for the filenames and instead use them only in the images' captions.

Forgotten password

If you forgot the password for an album, just delete the password (on the album's page) and create a new one.

If you forgot the admin password, you need to delete the file called .pw, which will be in the base directory of Shampoo. Then visit the gallery and you will be asked to choose a new one.

Contact

If the steps above didn't help, if you encounter bugs or if you have any other questions, email me:

r [at] this domain

Comments (124)

Newest first Oldest first Page 1 of 7 Next 20 »

  1. Ygbakiyt's avatar Ygbakiyt

    We're at university together http://ysigejauguho.de.tl Teen Tv Models

    Before I,d fuck her after seeing her take that cock I,d write my name on the soles of my shoes so you,ll know it,s me in there

    #124 – 15 May, 2012 at 12:24 am

  2. Lracxqku's avatar Lracxqku

    perfect design thanks http://jyfitityhyt.de.tl sweet model barbie

    Lmao. I remember watching this before I had an account. I feel sorry for both of them really. I couldn't even see myself gettin' off if I moved like that while fucking. And the girls holding conversations and shit. lol. tsk, tsk, tsk

    #123 – 5 May, 2012 at 11:44 pm

  3. Syrfxqvy's avatar Syrfxqvy

    I can't stand football http://eleoriyqo.de.tl litle nude nymphets She is a realy profi ! She is a dirty bitch and she likes to fuck - come to me

    #122 – 3 May, 2012 at 11:00 pm

  4. Bnozxplb's avatar Bnozxplb

    We'll need to take up references http://tugydibejy.de.tl sweet cindy forum bbs luv the chemistry between the old man and the girl..age is no bar...i wish all old men fuck like this...even they dnt fuck this hard but still they turn me on while making out...

    #121 – 2 May, 2012 at 1:39 pm

  5. Qucwnrml's avatar Qucwnrml

    What company are you calling from? http://imiruucutyy.de.tl dealornodeal models she needs to do an interracial vid and take a pussy cp from a dark black man...the contrast would be a huge turn on.

    #120 – 2 May, 2012 at 10:59 am

  6. Rxrnmguk's avatar Rxrnmguk

    How much does the job pay? http://binydukaic.blog.free.fr/ lolta to bbs You gotta feel for old Mike Bradshaw, having that ass writhing around on your cock and not able to stick it in coz you are doing softporn.

    #119 – 2 May, 2012 at 3:35 am

  7. Lenin's avatar Lenin

    I just copied the shampoo folder onto my server and loaded index.php and got the following error:

    Internal Server Error

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

    #118 – 3 April, 2012 at 11:52 pm

  8. sem's avatar sem

    I would like that the menu is always sticky, how can i do that?

    #117 – 2 April, 2012 at 1:55 pm

  9. Rafael's avatar Rafael

    Thank you for all the suggestions and feedback. I'm on holiday right now and cannot fix these problems, but I'll be back in about two weeks when I'll have a go at fixing these problems.

    #116 – 27 March, 2012 at 12:52 am

  10. Chris's avatar Chris

    Thank you for this excellent tool. Simple effective and easy to run on my little Sheevaplug, which isn't very powerful.

    I do have some suggestions for future versions, if you're interested:

    1. It would be good if you could use the EXIF orientation information to show images in portrait mode, where applicable.

    2. It's currently slightly difficult to download the photo set, as you have to load each photo into the lightbox viewer and then right click to "save as" for each one.

    It would be ideal if there were an intermediate image size for web viewing, which was different from the full size for downloading. Currently my 7 megapixel photos are too big for viewing in the browser. Maybe the web size could be configurable in the admin interface, and maybe there could be a little button under the thumbnail (and the web viewed version) to download the full size image ?

    I know that's a lot ;) I could have a look at maybe doing some of it for you if you want.

    #115 – 21 January, 2012 at 4:56 pm

  11. mindctrl's avatar mindctrl

    I love this gallery and its simplicity. But I have one question and hoping it's not too hard.

    How difficult would it be to add support for sub folders?

    Example:

    domain.com/football/folder1

    domain.com/football/folder2

    As of now, it only shows images from the first folder (/football).

    #114 – 30 December, 2011 at 2:44 pm

  12. Tony Walsh's avatar Tony Walsh

    Ooops! I meant Win XP (not Win 98). Am I showing my age or what :)

    #113 – 14 December, 2011 at 11:23 am

  13. Tony Walsh's avatar Tony Walsh

    Great package. Thanks.

    However, while it fine under Windows 98 and my local XAMP on my remote site when I enter an album it list the contents rather than display the thumbnails. Any ideas?

    #112 – 14 December, 2011 at 11:23 am

  14. James's avatar James

    Got it working. Added a .htaccess file with the following.

    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteRule . index.php [L,QSA]

    #111 – 7 December, 2011 at 7:52 pm

  15. James's avatar James

    I'm having a problem. The main page displays and clicking the thumbnail works fine. However when you click on the gallery title I get a 404 page. Any suggestions? Using GoDaddy.

    #110 – 7 December, 2011 at 7:35 pm

  16. cengbrecht's avatar cengbrecht

    Just setting this up to show some of the pics I took for a game test, sofar it seems that its rewriting the base domain to the local address, do you have any suggestions to how I could stop that?

    #109 – 2 December, 2011 at 12:46 am

  17. cengbrecht's avatar cengbrecht

    Just setting this up to show some of the pics I took for a game test, sofar it seems that its rewriting the base domain to the local address, do you have any suggestions to how I could stop that?

    #108 – 1 December, 2011 at 9:16 pm

  18. david's avatar david

    Great script! The opn album errors out though, not sure if i am supposed to add a pageinto each gallery i create...?

    #107 – 3 October, 2011 at 11:40 am

  19. Bajka's avatar Bajka

    I had to save .htaccess as UTF-8 without BOM(Byte order mark)

    #106 – 25 September, 2011 at 5:35 pm

  20. Sergio's avatar Sergio

    The problems with .htaccsess in v0.7 are due to win/dos format. Convert/save it to unix format (I use Notepad++) to solve this problem, otherwise Linux servers can't understand line breaks. Look at the logs.

    #105 – 24 September, 2011 at 8:10 am

Page 1 of 7 Next 20 »

Post a comment (Optional)
  • Allowed markup: <a> <i> <b> <em> <u> <s> <strong> <code> <pre> <p>
  • All other tags will be stripped, unless they are in a <pre> (use this for blocks of code)
  • External links will have the rel="nofollow" attribute applied