chrisspeck.com

Chris' random ramblings

Troubleshooting Gallery2 HTTP Status 500 Internal Server Errors

If you are receiving a “HTTP Status 500 Internal Server Error” when trying to Edit or view a Gallery2 setup, you would ought to check whether your choice of graphics toolkit is the cause of the error.

In a gallery I was setting this morning, the “Gd” graphics toolkit was causing the site to crash because of a time-out which arose when Gallery2 attempted to use Gd to generate a thumbnail.

The fix is to fight your way to the Admin/Plugins page, configure and activate the ImageMagick plugin, and deactivate (& delete) the Gd plugin.

Incidentally, the only way to trouble-shoot Gallery2 when it is in this condition is to:

  1. Check your host’s error log for any errors generated by the PHP scripts and/or Apache; and
  2. Activate Gallery2′s immediate debug mode.

Immediate debug mode should at least generate output, the last line of which should indicate where/why Gallery2 has died.

Finally, if you are running on a Linux Host / LAMP stack and you want to use a local php.ini, you must put the following line in the  .htaccess file:

SetEnv PHPRC /path/to/httpdocs/
posted by specky in IT,Programming and have No Comments

Conditional Gallery2 Shopping Cart Block

I am in the process of developing a photography website, and for that purpose I am combining WordPress + Gallery2.

Gallery2 has a very neat shopping cart feature, which lets a viewer select images, and then purchase/download, order prints, email etc in one go.

Gallery2 comes with a “Shopping Cart Info” block (a design element) which shows the contents of the cart. If selected, this block will display itself, whether or not there is actually anything within the cart.

I thought it looked a little tacky for the site to show a shopping cart on the gallery, and sub-gallery pages when there is nothing in it.

My solution to this issue was to create a new block, called “Conditional Cart Info”, which invokes the original “Shopping Cart Info”, only if the contents of the cart is greater than 0.

It requires a modification to the file /modules/cart/templates/blocks/blocks.inc and the creation of a new file /modules/cart/templates/blocks/ConditionalCart.tpl.

You can download my modified files here or click through below to read the source code:
blocks.inc
ConditionalCart.tpl

 

Read more…

posted by specky in Downloads,Programming and have No Comments

WordPress more tag patch for Facebook Photo Fetcher

I have been experimenting with using the brilliant Facebook Photo Fetcher plug-in (by Justin Klein) to present the photos I have on Face Book however it didn’t work quite the way I wanted.

The specific problem is that there was no way to split a gallery with a <!--more--> tag.

(Having two references to Facebook Photo Fetcher, with a more tag in between does not work either).

So I have edited the source of the plunging to introduce the functionality I need and I have added support for a more=n stanza to the plungin.

The edits (to version 1.2.8 of _output_gallery.php) are as follows:

1. At line 108 insert:

//1.2.8-cs
if( preg_match('/more=(\d+)/', $retVal['startTag'], $matches) )      $retVal['more']      =$matches[1];

2. At line 293 insert:

//1.2.8-cs
//Insert a more tag?
if( $params['more'] > 0 && $i == $params['more'] ) $retVal['content'] .= "<!--more-->\n\n";


An example usage is this:

<!--FBGallery [ID#] more=8 --><!--/FBGallery-->

This will insert a <!--more--> tag after your eighth image. I suggest you set this number to be a multiple of your column count (with default settings, 4 or 8 are good numbers).

If you want you can download a pre-hacked version of _output_gallery.php in a zip file (note this will only work for version 1.2.8 of Justin Klein's plug-in).

Full credit for creating the plugin goes to Justin Klein, I am very grateful to him for sharing it and you may visit his site here, and the plug-in's info and FAQ is here.

posted by specky in Downloads and have No Comments

Joomla to Coppermine sync script

It appears that the Joomla to Coppermine sync script I wrote and gave away in September 2006 is quite popular (judging by the number of 404 errors logged on that particular file). Baring in mind the following points, I offer it to the world for download once more:-

  1. It is a one way synchronisation from the Joomla CMS 1.0.x series membership database to the Coppermine Gallery membership database. The proper way to use this would be to deactivate registrations in Coppermine, and instead rely on the system in Joomla.
  2. Backup your databases before testing it.
  3. I recommend using it only if you are proficient in SQL and PHP
  4. You will need to call this periodically to keep the database in sync (set up a cron job if able)
  5. It is released under the version 2 (or at your option any latter version) of the GPL license and is open source.
There are ten configuration parameters at the top of the script with descriptions of what they do, that you will need to review and change to get it to run on your server.
Your mileage may vary with the current version of Joomla, series 1.5.x. If you are running Joomla 1.5.x, and modify this script to make it run between that version of Joomla and the current version of Coppermine, I would welcome it if you decided to share your code with me – I would, with your permission, upload the same (and give you credit) and offer it for download here.
posted by specky in Downloads,Uncategorized and have No Comments