Need help debugging my plugin

i have created a plugin (code available on github) that adds two buttons to rotate pictures via the omeka admin on files views pages. I was working fine until some months ago and I believe one of the update to omeka core has broken things but I can’t find what the issue is.

At the moment I get an error in the file application/libraries/Omeka/File/Derivative/Strategy/ExternalImageMagick.php because the getOptions(“path_to_convert”) returns an empty string, even if this option is set in my database. I have been able for the moment to quickfix the issue by replacing :

$path = $this->getOption('path_to_convert');

to :

$path = $this->getOption('path_to_convert', '/usr/bin');

That works fine but I would be interested by an idea to properly fix that. I believe that there is an issue in the way I am creating the derivative stratergy but I can’t figure it out.

Thanks for any pointer !

Am I guessing right that this error only happens via your plugin’s work, and not when you add an item the usual way?

If so, it sounds like you’re right – something’s amiss in creating the strategy, in particular with the options that are set.

Embarassingly, this appears to be a problem in the pull request I sent you long ago!

At this line:

    if (!$pathToConvert = get_option('path_to_convert')) {
                throw new Omeka_File_Derivative_Exception(__('The ImageMagick directory path is missing.'));

change it to

    $pathToConvert = get_option('path_to_convert');
    if (empty($pathToConvert)) {
        throw new Omeka_File_Derivative_Exception(__('The ImageMagick directory path is missing.'));

At least that worked for me. Might be a change in how PHP interprets that construction between different versions.

Thanks @patrickmj for taking time to find the error, I have no access to my omeka install at the moment, will let you know if that fixes the issue.

This was the correct way to fix the issue, i have updated the plugin on github.