# Photo and video Gallery on the web

## bhayes

In setting up my web server to host some photos and movies, I came across Gallery - which is an amazing sourceforge project.

Anyway, I spent some time getting it working - and here is a general how-to for anybody who wants to get it up and running:

It is easy to get... just 'emerge gallery' - it is in the portage tree.

It has a lot of dependancies... the most important being Apache and php - but even after that there are 10 or so imaging programs and the like.

If you have apache & php working, just emerge it - wait for it to finish, and it will have put a directory under your web server's htdocs called 'gallery'.

Go into that directory, and type './configure' - and then browse to "http://IpAddress/gallery/setup/" - and you can set it up.

Once you have finished the setup - type './secure' - and it will secure it and make it work, and from then on you can browse to "http://IpAddress/gallery/" and it will work. From there you can log in as admin and upload photos, create albums, etc.

3 things which were problems for me:

1) On the first page of setup it gives a mammoth error about not finding "configure" or "secure" scripts - ignore it;

2) When you are uploading photos using the "Add Photos" command (later on), if you try and upload more than 2 or 3 it will crash. Instead, SSH to your server and manually place your photos in a temp directory (eg. /tmp/photos/) and then choose option 2: supply a directory

3) In the setup phase it asks for the web address of your gallery. I used my http://bamboosoftware.dynalias.org/gallery/ address - if you use your local LAN address, when you open it up to the web it goes all bad.

Thats it. Cheers.

----------

## zeky

Nice.   :Wink: 

----------

## RSay

This worked great! 

I love this guide because it is ridiculously simple.  

I spent one weekend of my life trying to get this gallery running on my redhat machine. I went through dependency hell and then couldn't find recent enough versions of some packages to get things running. I called a friend of mine who knows powerful linux magic and asked for help. He spent two hours of his time building rpms from tar.gzs etc. It didn't work. 

He had mentioned Gentoo to me and I said, "How hard would this be in Gentoo?" He spent ten minutes explaining portage to me and I hung up the phone and started installing Gentoo. 

I love this distribution. It has taught me a lot about my computer and my gallery looks great.   :Very Happy: 

----------

## Krigare

 *RSay wrote:*   

> I spent one weekend of my life trying to get this gallery running on my redhat machine. I went through dependency hell and then couldn't find recent enough versions of some packages to get things running. 

 

heh.. exactly as me.. this is again probably why people use gentoo..

----------

## tactless

I've been using this gallery thing for a few weeks now... love it!

----------

## Ian

I just installed it, and it seems to be working, except for one thing.

I use Smoothwall 2.0 as my firewall.  It blocks any "call-back" requests, as in, I can't access the website by going out, and coming back in (that I know of).

This means that I can't view my gallery from outside, or at least not easily.

Is there anyway around this (either through gallery, apache, smoothwall, or /etc/hosts)?

----------

## Ian

Erm, quick update.

I have the program working internally, sort of.  But not outside of my LAN.

http://wolos.d2g.com:5190/gallery/albums.php

That should work, but it doesn't seem to work for me.

I think part of the problem may infact be my Smoothwall box, as it doesn't allow "IP Spoofing", so I can't see the gallery, or everyone else can't see the gallery. And my friend just confirmed this.

If there is a way to get around using the entire URL for gallery, that'd fix the problem, otherwise I'll have to go and figure out how to screw around with Smoothwall :-\.

----------

## Ian

I swear, this is it for the night...

I was looking through the Gallery docs, and I found a solution.

If you have a firewall like Smoothwall, that does "Anti-Spoofing", the way to fix this is very simple.

Open up ./gallery/config.php in your favorite editor.

Scroll down to the two URLs.

Change them to be relative, from http://www.example.com/gallery to /gallery (you should be able to figure the second one out as well  :Wink: ).

Just got it working, and confirmed with a friend, so it's all good  :Very Happy: .

----------

## dstutz97

 *Ian wrote:*   

> I use Smoothwall 2.0 as my firewall.  It blocks any "call-back" requests, as in, I can't access the website by going out, and coming back in (that I know of).
> 
> This means that I can't view my gallery from outside, or at least not easily.
> 
> Is there anyway around this (either through gallery, apache, smoothwall, or /etc/hosts)?

 

I've been using ipcop/smoothwall for a while.  The way I got around this was adding an alias on my webserver and then adding the ip to /etc/hosts on the smoothwall box.  On your gentoo server, edit /etc/conf.d/net and add another IP for your box in the aliases section.  At this point running /etc/init.d/net.eth0 restart should hopefully bring up the alias...if not then just reboot.  I'm not sure of how to do this.

Then on your smoothwall box add a line to the /etc/hosts with:

ip.you.just.added   www.yourdomain.com

and reboot the router (supposedly dnsmasq is supposed to pick up these changes immediately, but it never works on the client-side for me...so reboot if you have to).  When it comes back up you should be able to access your internal website via "www.yourdomain.com" and have it be hitting the internal lap IP.  If you need more help, lemme know.

Dave

----------

## Krigare

check out coppermine.sf.net

----------

## rmbalfa

I am still getting this error:

```

Fetching Urls...

Warning: parse_url(http:///home/ryan/my digital pictures/Gamma Phi/write-on_2004): Unable to parse url in /var/www/localhost/htdocs/gallery/save_photos.php on line 115

Could not open url: http:///home/ryan/my digital pictures/Gamma Phi/write-on_2004

Processing status...

```

The directory is: /home/ryan/my digital pictures/Gamma Phi/write-on_2004

I tried this page but it didn't help.

I dont even understand what it is doing.

----------

## dstutz97

 *rmbalfa wrote:*   

> 
> 
> I tried this page but it didn't help.
> 
> I dont even understand what it is doing.

 

Well, It looks like you are getting that same error as the messages are similar and the parse error is happening on the exact same line of the source code.  I might take a guess and ask if you are trying to upload a picture and it is greater than 500k?  The gallery documentation says to change the mod_php.conf's LimitRequestBody directive to 0 effectively disabling the limit on uploaded file sizes.  You can read up a little more about that directive here: http://httpd.apache.org/docs/mod/core.html#limitrequestbody

I'd suggest doing exactly what your linked Gallery help page suggests, change the # for LimitRequestBody to 0 for unlimited size or a reasonably high # that will work for your environment to allow for the uploading of pictures, movies and zip files containing pictures+movies.

----------

## rmbalfa

Setting it to 0 did not work. II am running this my my own box right in front of me. I dont want the http://. Maybe that the problem?

----------

## rmbalfa

This is the problem code:

```

      /* If the URI doesn't start with a scheme, prepend 'http://' */

      if (!fs_is_file($url)) {

         if (!ereg("^(http|ftp)", $url)) {

            $url = "http://$url";

         }

         /* Parse URL for name and file type */

         $url_stuff = parse_url($url);

         if (!isset($url_stuff["path"])) { 

            $url_stuff["path"]="";

         }

         $name = basename($url_stuff["path"]);

      } else {

         $name = basename($url);

```

My URI doesn't start with a scheme, but I don't want one. Maybe thats the problem.

----------

## dstutz97

Well....gallery is a php app that needs to run on the webserver so you're going to need the http://.  I know there's a way to run php stuff standalone (hence php and mod_php packages in portage) but I have no idea if you can do that with gallery.  It looks like you might have the paths setup wrong...I'd put it back into config mode and go through and check that stuff again...if all else fails check the gallery mailing list...they can probably give you better help than I.

----------

## rmbalfa

Yes, of course it needs a srever. But the files I am trying to upload are already on that server in my home directory so htto:// is not needed in fact it is wrong for my case. I would need a file:// scheme or something like that as I see it?

I hope that clarifies, it doesn't seem you understood my problem.

----------

## Tun

cheers for the tips bhayes.  ive just emerged gallery and found this thread after forum searching because I wasnt 100% sure what was next.  very useful.

interesting photo album too.  i feel i must apolgise on behalf of drunken mancunian from new years  :Smile:  liam gallagher has a lot to answer for.  so many idiots from round here think the success  of  oasis gives them license to act like complete and utter fools (psuedorockstars).  the odd gallagher wannabe is funny, most of em are beyond annoying, we're not all like that  :Smile: 

----------

## ultrasonic

BTW about that configure/secure script "serious warning" (or was it critical?).  The reason for that is because configure.sh and secure.sh turn out to be owned by root.  You can easily fix it by chown apache scure.sh configure.sh and then su apache and run the configure/secure scripts.  No errors or warnings then!

----------

## joehni

Just to mension another alternative: LinPHA also from sourceforge. Runs for me without major problems and was plain easy to install.

http://linpha.sf.net

----------

## ice_cool

One good alternative is also 

app-misc/bins

----------

## cortinez

1st i emerge apache, then emerged php_mod then last i emerged gallery. 

when i went to the gallery directory and i did ./configure which made the site insecure then went to my browser and put my http://ipaddress/gallery/setup and it gave me a page could not be displayed. Do i need to do anything special to the apache2.conf or the DocumentRoot line in that conf file. Need some help thanx

----------

## wizard69

emerging right now thx for the tip should keep me out of mischief for a while

----------

## cortinez

Thanks hayes for the help got it up and running just trying to do some tweaks and getting some pics uploaded.

----------

## wizard69

 *Quote:*   

> Change them to be relative, from http://www.example.com/gallery to /gallery (you should be able to figure the second one out as well ). 

 

i changed the two urls to a relative directory so my config.php reads

```
$gallery->app->photoAlbumURL = "/gallery";

$gallery->app->albumDirURL = "/albums";

```

i can access the gallery from my lan and from the web but when i want to upload pictures from the lan with the admin frontend i allways get an error can't find url http:///gallery/gallery with three slashes which of course does not exist also the hostname ist missing

----------

## lamekain

If you're installing gallery for Gentoo, remember to use webapp-config to do it the Gentoo way (tm). With webapp-config you can create multiple virtual installations. Webapp-config uses links, so that disk space is saved, and it takes care of you're configs and allows easier upgrading, etc.. for more info see man webapp-config

quick'n'dirty on my server:

```
emerge gallery

webapp-config -I -h localhost -d gallery -u USERNAME gallery 1.4.4_p4

cd /var/www/htdocs/gallery

touch /var/www/htdocs/gallery/.htaccess /var/www/htdocs/gallery/config.php

chown apache:apache /var/www/htdocs/gallery/.htaccess /var/www/htdocs/gallery/config.php

```

This installs gallery into localhost at /var/www/htdocs/gallery and gives USERNAME permissions to change the files. After this point your browser to http://yourserver.com/gallery/setup and proceed.

Note: If your www-document directory is not /var/www then edit /etc/vhosts/webapp-config.

----------

## ZothOmmog

I get the following when I try to add images to an album using Imagemagik:

```
File /var/www/localhost/htdocs/albums/xmas03/121503openingpresents_001.jpg type 2.

Executing:

      '/usr/bin/convert' -quality 90 -size 150x150 +profile '*' '/var/www/localhost/htdocs/albums/xmas03/121503openingpresents_001.jpg' -geometry 150x150 '/var/www/localhost/htdocs/albums/xmas03/121503openingpresents_001.thumb.jpg'

Results:

none

Debug messages::

convert: no decode delegate for this image format `add_photos.php'.

convert: no decode delegate for this image format `add_photos_frame.php'.

sh: line 1: html2ps: command not found

convert: Delegate failed `"html2ps" -U -o "%o" "%i"'.

convert: no decode delegate for this image format `adv_search.php'.

convert: no decode delegate for this image format `album_permissions.php'.

convert: no decode delegate for this image format `albums.php'.

convert: no decode delegate for this image format `block-random.php'.

convert: no decode delegate for this image format `captionator.php'.

convert: no decode delegate for this image format `config.php'.

convert: no decode delegate for this image format `configure.sh'.

convert: no decode delegate for this image format `copy_photo.php'.

convert: no decode delegate for this image format `create_user.php'.

convert: no decode delegate for this image format `delete_album.php'.

convert: no decode delegate for this image format `delete_photo.php'.

convert: no decode delegate for this image format `delete_user.php'.

convert: no decode delegate for this image format `do_command.php'.

convert: no decode delegate for this image format `edit_appearance.php'.

convert: no decode delegate for this image format `edit_caption.php'.

convert: no decode delegate for this image format `edit_field.php'.

convert: no decode delegate for this image format `edit_thumb.php'.

convert: no decode delegate for this image format `edit_watermark.php'.

convert: no decode delegate for this image format `extra_fields.php'.

convert: no decode delegate for this image format `gallery_remote.php'.

convert: no decode delegate for this image format `gallery_remote2.php'.

convert: no decode delegate for this image format `index.php'.

convert: no decode delegate for this image format `init.php'.

convert: Improper image header `LICENSE.txt'.

convert: no decode delegate for this image format `login.php'.

convert: no decode delegate for this image format `manage_users.php'.

convert: no decode delegate for this image format `manifest.inc'.

convert: no decode delegate for this image format `modify_user.php'.

convert: no decode delegate for this image format `move_album.php'.

convert: no decode delegate for this image format `move_photo.php'.

convert: no decode delegate for this image format `multi_create_user.php'.

convert: no decode delegate for this image format `new_password.php'.

convert: no decode delegate for this image format `nls.php'.

convert: no decode delegate for this image format `photo_owner.php'.

convert: no decode delegate for this image format `poll_properties.php'.

convert: no decode delegate for this image format `poll_results.php'.

convert: no decode delegate for this image format `progress_uploading.php'.

convert: no decode delegate for this image format `publish_xp.php'.

convert: no decode delegate for this image format `publish_xp_docs.php'.

convert: no decode delegate for this image format `register.php'.

convert: no decode delegate for this image format `rename_album.php'.

convert: no decode delegate for this image format `reset_votes.php'.

convert: no decode delegate for this image format `resize_photo.php'.

convert: no decode delegate for this image format `rotate_photo.php'.

convert: no decode delegate for this image format `rss.php'.

convert: no decode delegate for this image format `save_photos.php'.

convert: no decode delegate for this image format `search.php'.

convert: no decode delegate for this image format `secure.sh'.

convert: no decode delegate for this image format `session.php'.

convert: no decode delegate for this image format `slideshow.php'.

convert: no decode delegate for this image format `sort_album.php'.

convert: no decode delegate for this image format `upgrade_album.php'.

convert: no decode delegate for this image format `upgrade_users.php'.

convert: no decode delegate for this image format `user_preferences.php'.

convert: no decode delegate for this image format `util.php'.

convert: no decode delegate for this image format `Version.php'.

convert: no decode delegate for this image format `view_album.php'.

convert: no decode delegate for this image format `view_comments.php'.

convert: no decode delegate for this image format `view_photo.php'.

convert: no decode delegate for this image format `view_photo_properties.php'.

convert: no decode delegate for this image format `watermark_album.php'.

convert: no profile `add_comment.php' found.

Status: 1 (expected 0)

Error: Unable to make thumbnail (0)

Need help? Look in the Gallery FAQ 
```

Any suggestions?

----------

## ZothOmmog

Fixed it...

Here's how in case anyone else has this issue.

----------

## mileswu

Coppermine is so much better. It is also so easy to install being php...

----------

## someguy

i keep getting this i dont get it i looked at line 39 and its obvious so i dunno i ran configure.sh

"Fatal error: Call to undefined function session_id() in /var/www/ibis/htdocs/gallery/session.php on line 39"

----------

## someguy

anyone ?

----------

## friism

Yeah, same thing here.

----------

## friism

Eureka!

https://forums.gentoo.org/viewtopic-t-221348-highlight-call+undefined+sessionid.html

...and it even makes sense!

----------

## tj

I have the following set up and working:

- apache2

- php

- mysql

- dyndns 

- mambo

- gallery

However, when I try and embed gallery as a component of mambo (which works up to gallery appearing in mambo backend component menus) I get an error when entering the absolute path to gallery as below:

```
Table 'mambo.mos_mamtestgallery' doesn't exist SQL=UPDATE mos_mamtestgallery SET value='/var/www/localhost/htdocs/gallery/' WHERE field='path'
```

clearly it's an issue with mysql but (a) why? (b) how do I fix it?

EDIT: Fixed it myself - here's how if you have the same problem:

The name of MySQL table that Mambo wanted to use and that created when integrating gallery into Mambo did not match. So you have to rename the table in the Mambo database.

Log on to MySQL

```
mysql -u root -p
```

enter your password and then select the appropriate database

```
use mambo;
```

take a quick look at the tables (optional) and rename the culprit

```
show tables;

ALTER TABLE mos_gallery RENAME mos_mamtestgallery;

exit

```

I suspect that if you go with default names you probably won't run into this issue... hope this helps someone

----------

