Gallery Image Album Troubleshooting

Gallery is a great application for photo albums, provided by DreamHost as a One-Click install, and thus we have tested it to be a robust system to upload, organize, and display your images. However, just like any other application, it can run out of control and use too many resources. The first step, as with any application, is to visit the Gallery Image Album website and make sure you're using the latest version of Gallery. Also check for any security patches and/or notices.

The Gallery Image Album FAQ notes a bug in Gallery 2 that may cause performance issues:

There's a known bug in the 2.0 release where if you import a large number of albums from Gallery 1, it can fail to optimize the permissions table leading to really bad performance (2-3+ second response times for a page load). If that happens, you can fix it. Just change any permission anywhere in your G2. You may have to do this a couple of times because each time you change a permission it has a 50% chance of re-optimizing your permission table. If you want to check the before/after, you can run this query: * select count(*) from g2_AccessMap; Before and after the permission change. If the number of rows drops dramatically (like from 2000 rows down to 30) then you've fixed the problem.

Due to the nature of image galleries, it could be that many of the requests to your site are users remotely linking your images (often referred to as bandwidth stealing!) If you wish to discourage this activity, a few simple lines in your .htaccess file may help drop your usage dramatically. First of all, you'll need to upload an alternative image to your website directory (for example, a simple image that has a small file size that simply states "Please download this image instead of linking it directly"). Let's call this image alt-image.jpg, and we'll store it in the images/ directory of our website (for example, you may call your image store something else entirely).

Now all you need to do is create a file called .htaccess (don't forget the leading dot!) In that file, put in the following lines:

RewriteEngine on

RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http:///.*$ [NC]

RewriteRule \.(png|PNG|gif|GIF|jpg|JPG)$ http://yourwebsite.com/alt-image.jpg [R,L]

The .htaccess file needs to be located in the document root of your website (so it needs to be yourwebsite.com/.htaccess). The permissions need to be set to 644 on it too (chmod 644 .htaccess on the command line).

Gallery Image Album is a mature application, and has been in development since 2000. The developers have done a lot of work to make sure Gallery is very fast and works in an optimal manner at all times. If you are not affected by the above bug, are running the latest version, and have not been compromised by a hacker, it is more than likely that you are running a very large image website that has become very popular. While our shared hosting servers are very good at handling quite a bit of traffic from our customers, there does come a point sometimes where a site will outgrow shared hosting and need to move onto the next step - a shiny new DreamHost PS!

Handy Links

Gallery FAQ