ImageMagick Not Working on Shared Server

It seems many others have encountered a similar problem of unable to upload images or files, but I haven't seen many solutions. That said, here's my error.

Our site (collectionsweb.jhu.edu) is running 2.2 on a shared server. ImageMagick has been installed on the server, but proc_open() has been disabled and cannot be enabled.

I have configured Omeka to use the server's ImageMagick via 'fileDerivatives.strategy = "Omeka_File_Derivative_Strategy_Imagick"` code in the application/config/config.ini.

Attempts to test the ImageMagick Directory Path result in this error:

Omeka_File_Derivative_Exception
Failed to execute command: /usr/bin/convert -version.

#0 /home/collectionsweb/public_html/application/libraries/Omeka/File/Derivative/Strategy/ExternalImageMagick.php(154): Omeka_File_Derivative_Strategy_ExternalImageMagick::executeCommand('/usr/bin/conver...', NULL, NULL, NULL)
#1 /home/collectionsweb/public_html/application/controllers/SettingsController.php(196): Omeka_File_Derivative_Strategy_ExternalImageMagick::isValidImageMagickPath('/usr/bin')
#2 /home/collectionsweb/public_html/application/libraries/Zend/Controller/Action.php(516): SettingsController->checkImagemagickAction()
#3 /home/collectionsweb/public_html/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('checkImagemagic...')
#4 /home/collectionsweb/public_html/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#5 /home/collectionsweb/public_html/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(101): Zend_Controller_Front->dispatch()
#6 /home/collectionsweb/public_html/application/libraries/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#7 /home/collectionsweb/public_html/application/libraries/Omeka/Application.php(79): Zend_Application->run()
#8 /home/collectionsweb/public_html/admin/index.php(28): Omeka_Application->run()
#9 {main}

And attempts to upload files to posts and save result in this error:

Omeka_File_Derivative_Exception
Failed to execute command: /usr/bin/convert '/tmp/deebb1a15ff70c0a8df711af7d287e89.jpg[0]' -background white -flatten -thumbnail '800x800>' '/tmp/fullsize_deebb1a15ff70c0a8df711af7d287e89.jpg'.

#0 /home/collectionsweb/public_html/application/libraries/Omeka/File/Derivative/Strategy/ExternalImageMagick.php(49): Omeka_File_Derivative_Strategy_ExternalImageMagick::executeCommand('/usr/bin/conver...', NULL, NULL, NULL)
#1 /home/collectionsweb/public_html/application/libraries/Omeka/File/Derivative/Creator.php(76): Omeka_File_Derivative_Strategy_ExternalImageMagick->createImage('/tmp/deebb1a15f...', '/tmp/fullsize_d...', 'fullsize', 800, 'image/jpeg')
#2 /home/collectionsweb/public_html/application/models/File.php(362): Omeka_File_Derivative_Creator->create('/tmp/deebb1a15f...', 'deebb1a15ff70c0...', 'image/jpeg')
#3 /home/collectionsweb/public_html/application/models/Job/FileProcessUpload.php(22): File->createDerivatives()
#4 /home/collectionsweb/public_html/application/libraries/Omeka/Job/Dispatcher/Adapter/Synchronous.php(25): Job_FileProcessUpload->perform()
#5 /home/collectionsweb/public_html/application/libraries/Omeka/Job/Dispatcher/Default.php(136): Omeka_Job_Dispatcher_Adapter_Synchronous->send('{"className":"J...', Array)
#6 /home/collectionsweb/public_html/application/models/File.php(209): Omeka_Job_Dispatcher_Default->send('Job_FileProcess...', Array)
#7 [internal function]: File->afterSave(Array)
#8 /home/collectionsweb/public_html/application/libraries/Omeka/Record/AbstractRecord.php(277): call_user_func(Array, Array)
#9 /home/collectionsweb/public_html/application/libraries/Omeka/Record/AbstractRecord.php(550): Omeka_Record_AbstractRecord->runCallbacks('afterSave', Array)
#10 /home/collectionsweb/public_html/application/models/Item.php(335): Omeka_Record_AbstractRecord->save()
#11 /home/collectionsweb/public_html/application/models/Builder/Item.php(204): Item->saveFiles()
#12 /home/collectionsweb/public_html/application/libraries/globals.php(573): Builder_Item->addFiles('Upload', 'file', Array)
#13 /home/collectionsweb/public_html/application/models/Item.php(320): insert_files_for_item(Object(Item), 'Upload', 'file', Array)
#14 /home/collectionsweb/public_html/application/models/Item.php(230): Item->_uploadFiles()
#15 [internal function]: Item->beforeSave(Array)
#16 /home/collectionsweb/public_html/application/libraries/Omeka/Record/AbstractRecord.php(277): call_user_func(Array, Array)
#17 /home/collectionsweb/public_html/application/libraries/Omeka/Record/AbstractRecord.php(531): Omeka_Record_AbstractRecord->runCallbacks('beforeSave', Array)
#18 /home/collectionsweb/public_html/application/libraries/Omeka/Controller/AbstractActionController.php(209): Omeka_Record_AbstractRecord->save(false)
#19 /home/collectionsweb/public_html/application/controllers/ItemsController.php(89): Omeka_Controller_AbstractActionController->editAction()
#20 /home/collectionsweb/public_html/application/libraries/Zend/Controller/Action.php(516): ItemsController->editAction()
#21 /home/collectionsweb/public_html/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('editAction')
#22 /home/collectionsweb/public_html/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#23 /home/collectionsweb/public_html/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(101): Zend_Controller_Front->dispatch()
#24 /home/collectionsweb/public_html/application/libraries/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#25 /home/collectionsweb/public_html/application/libraries/Omeka/Application.php(79): Zend_Application->run()
#26 /home/collectionsweb/public_html/admin/index.php(28): Omeka_Application->run()
#27 {main}

Is there anything we can do to solve this issue under the current setup?

Or should we just install it on a different server?

Any help would be appreciated.

Hi,

Did you try the integrated ImageMagick?


fileDerivatives.strategy = Omeka_File_Derivative_Strategy_Imagick

Sincerely,

Daniel Berthereau
Infodoc & Knowledge management

Your initial post said you set up the Imagick strategy, but the error message you posted indicates Omeka's still using the ExternalImageMagick strategy.

I'd double-check your config.ini.

Unfortunately the server can be a real pain about caching, but I went as far as deleting the config file, accessing the site and having it tell me said file was missing, and then reupload the edited file with the different Imagick Strategy.

But the error remains:

Omeka_File_Derivative_Exception
Failed to execute command: /usr/bin/convert -version.

#0 /home/collectionsweb/public_html/application/libraries/Omeka/File/Derivative/Strategy/ExternalImageMagick.php(154): Omeka_File_Derivative_Strategy_ExternalImageMagick::executeCommand('/usr/bin/conver...', NULL, NULL, NULL)
#1 /home/collectionsweb/public_html/application/controllers/SettingsController.php(196): Omeka_File_Derivative_Strategy_ExternalImageMagick::isValidImageMagickPath('/usr/bin')
#2 /home/collectionsweb/public_html/application/libraries/Zend/Controller/Action.php(516): SettingsController->checkImagemagickAction()
#3 /home/collectionsweb/public_html/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('checkImagemagic...')
#4 /home/collectionsweb/public_html/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#5 /home/collectionsweb/public_html/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(101): Zend_Controller_Front->dispatch()
#6 /home/collectionsweb/public_html/application/libraries/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#7 /home/collectionsweb/public_html/application/libraries/Omeka/Application.php(79): Zend_Application->run()
#8 /home/collectionsweb/public_html/admin/index.php(28): Omeka_Application->run()
#9 {main}

Let me know if you'd like temp credentials into the site.

Can you post the section of the config.ini file that has the line you added or changed? It's possible you just have some minor syntax issue there.

Note: the ImageMagick path setting and Test button always use the normal "external" ImageMagick strategy. Uploading a file (like you showed an example of in your first post) is the best way to test against the Imagick strategy.

Can do! See below:

;;;;;;;;;;;;;;;;;;;;;
; Derivative Images ;
;;;;;;;;;;;;;;;;;;;;;

; fileDerivatives.strategy
; Controls what method Omeka uses to create derivative images.
; default: Omeka_File_Derivative_Strategy_ExternalImageMagick
;
; The built-in strategies are ExternalImageMagick (the old default) and
; Imagick (requires PECL ext/imagick), but others can be added by plugins.
;
fileDerivatives.strategy = "Omeka_File_Derivative_Strategy_Imagick"

; fileDerivatives.strategyOptions
; Specific settings for the configured derivative strategy.
;

Thanks for the tip about uploading a file. When I attempt that, it says:

Destination directory is not writable: '/home/collectionsweb/public_html/files/original'.

#0 /home/collectionsweb/public_html/application/libraries/Omeka/Storage/Adapter/Filesystem.php(116): Omeka_Storage_Adapter_Filesystem->_rename('/tmp/05bac6b9ca...', '/home/collectio...')

Which is helpful.

I will now further bug my server people about getting write access to this.

Yes, those directories under files have to be writable no matter what derivative strategy you're using.

It's possible that the Imagick strategy is actually working already but you're just hitting a wall because Omeka can't store the files where they're supposed to go.

Working now, thanks!