Printable version

LinPHA is a PHP-based media gallery tool, similar to Coppermine or Gallery. I was helping someone with setting this up in their shared hosting account recently and ran into an issue I found very little information online to resolve. I thought, therefore, it might be useful to share the info online in case someone else might find it useful.

In particular, the challenge was getting LinPHA to work with GraphicsMagick. Although LinPHA is documented to support ImageMagick, GraphicsMagick is much improved and continues to be maintained. ImageMagick, on the other hand, is generally considered to be "mature" and has many known issues. Unfortunately, LinPHA needs some coaxing to talk to GraphicsMagick. But it's not impossible!

The key thing to remember is that IM's "convert" is almost completely identical in usage to "gm convert" (on the commandline). With this in mind, I was able to reduce the customizations required to get LinPHA to the following -- once I had completed the basic installation and ignored it's report that ImageMagick wasn't found.

  1. Update two values in the configuration table of the database.
    • compare_path = '<your full path>/gm ' (with trailing space)
    • use_compare = 1
       
  2. Comment the line in header.php that calls upgrade.php.
     
  3. Comment the line in image.php that adds the "-strip" option to the convert exec call.

The important bit about putting the trailing space on the "compare_value" value is that this is concatenated as a prefix to "compare <options>" in the code. By referring specifically to gm and including the space, LinPHA will unwittingly run gm with the apropriate options to convert the image as desired.

Now, I will point out that there may be an alternative to the use of "-strip" with gm, so that instead of simply commenting that option out it may be desired to update that line with a different option. But I have not researched or tested this at this point.

Page Updated: Friday, November 09, 2007