ImageMagick as PHP module

Hello,

My problem is Omeka cannot use ImageMagick library on my server. I asked the provider if ImageMagick is installed and which path I should use and he told me that ImageMagick is installed as a PHP module. If I understand it correctly, the path in Omeka settings is usable if ImageMagick would be installed as an executable (convert). Question is, can Omeka work with ImageMagick installed as a PHP module?

Any help would be much appreciated. Thanks!

Omeka doesn't currently work with the ImageMagick PHP library, it requires the executable version.

Hello,

Thank you for your answer, I was afraid of that. When you say that it does not currently work with the PHP library should I hope that this is on the near future roadmap? If not, please tell me if a lot of places should be patched for this to work. I am not afraid do to a couple of code modifications myself but I'd like to know before I start how much work is there to it and if it makes sense, or should I rather switch providers. Thank you for your time!

Best regards,
Florin.

It's something we're looking at, but I wouldn't call it a priority, and it's not on the roadmap at the moment (though experiences like yours let us know we've got actual users this will help, so we may re-think how important it is).

There's only one place where Omeka uses the ImageMagick code (well, there's also the various places where you can set and test the "convert" path, but they can be safely ignored): the file application/libraries/Omeka/File/Derivative/Image.php.

The current code calls out to the command-line tool, and those calls would need to be converted to equivalent calls to the Imagick PHP extension code.

Looking at application/libraries/Omeka/File/Derivative/Image.php it seems like an easy job, the code is very well commented. Thank you very much!

I see that this is a problem from a year ago, put is there somebody that have change the code to make use of the php extension. On my server it's not allowed to use a absolute path.

Hi,

Simply replace application/libraries/Omeka/File/Derivative/Image/Creator.php with the file https://gist.github.com/Daniel-KM/7559570.

Sincerely,

Daniel Berthereau
Infodoc & Knowledge management

This works and is awesome! Great solution, thank you very much!

I have this problem. I changed the Creator.php but when Omeka asks me the ImageMagick Directory Path ... I have the answer: "The ImageMagick directory path does not work". I write my path: / application / libraries / Omeka / File / Derivative /.Use the Omeka version 2.2. Thank You

Hi,

The hack works with some shared hosts, not all.

Instead of using it, use the default file and change, in the application/config/config.ini, the line

fileDerivatives.strategy = "Omeka_File_Derivative_Strategy_ExternalImageMagick"

by

fileDerivatives.strategy = "Omeka_File_Derivative_Strategy_Imagick"

Sincerely,

Daniel Berthereau
Infodoc & Knowledge management

Hello, I have not tested positive Omeka 2.1 and 2.2
In summary:
1) I have replaced the creator.php file (application / libraries / Omeka / Archive / Derivatives / image and Omeka 2.1; and application / libraries / Omeka / File / Derivative in Omeka.2.2)

2) I have replaced in application / config / config.ini, the line fileDerivatives.strategy = "Omeka_File_Derivative_Strategy_ExternalImageMagick" by fileDerivatives.strategy = "Omeka_File_Derivative_Strategy_Imagick"

In Omeka 2.2 screen turns white; in Omeka 2.1 I do not see the pictures of the items... help!

For Omeka 2.2 and newer, if you have the Imagick extension for PHP installed and want to use that, all you need to do is set the fileDerivatives.strategy line to "Omeka_File_Derivative_Strategy_Imagick" in application/config/config.ini (make sure you get rid of the semicolon at the front of the line if there's one there, too).

With the Imagick strategy enabled, the "ImageMagick Directory Path" box in the site settings doesn't matter at all. You also should not replace the Creator.php file. That was a workaround/hack for older versions. It's not needed for Omeka 2.2 and up, and will likely cause problems. You should be using the copy of that file that came with Omeka.