Ext ImageMagick problem - Piwigo 16 #2139

Closed
opened 2026-10-05 01:07:29 +02:00 by adam · 0 comments
Owner

Hi,

I noticed that the maintenance page in Piwigo 16 doesn't show ext_imagick, so I found out there is probably a bug in "get_ext_imagick_command()" function (image.class.php).

From the use in code I think this function is supposed to return only command to run (magick/convert), but it in fact returns ext_imagick_dir (path) as well.

https://github.com/Piwigo/Piwigo/commit/3293b329e916b743c56f786227a1be6c47f0f4c9

So when other function use it (like is_ext_imagick()), the result is wrong (due to duplicate path):

@exec($conf['ext_imagick_dir'].pwg_image::get_ext_imagick_command().' -version', $returnarray);

The function should be probably like this:

  static function get_ext_imagick_command()
  {
    global $page, $conf;

    if (!isset($page['ext_imagick_command']))
    {
      $retval=null;
      $cmd_out=null;
      // check if magick is in path
      exec('command -v '.$conf['ext_imagick_dir'].'magick', $cmd_out , $retval );
      if (0 == $retval)
      {
        $page['ext_imagick_command'] = 'magick';
      }
      else
      {
        $page['ext_imagick_command'] = 'convert';
      }
    }
    
    return $page['ext_imagick_command'];
  }

After this change the external ImageMagick is shown.

Thank you.

Hi, I noticed that the maintenance page in Piwigo 16 doesn't show ext_imagick, so I found out there is probably a bug in "get_ext_imagick_command()" function (image.class.php). From the use in code I think this function is supposed to return only command to run (magick/convert), but it in fact returns ext_imagick_dir (path) as well. [https://github.com/Piwigo/Piwigo/commit/3293b329e916b743c56f786227a1be6c47f0f4c9](https://github.com/Piwigo/Piwigo/commit/3293b329e916b743c56f786227a1be6c47f0f4c9) So when other function use it (like is_ext_imagick()), the result is wrong (due to duplicate path): `@exec($conf['ext_imagick_dir'].pwg_image::get_ext_imagick_command().' -version', $returnarray);` The function should be probably like this: ``` static function get_ext_imagick_command() { global $page, $conf; if (!isset($page['ext_imagick_command'])) { $retval=null; $cmd_out=null; // check if magick is in path exec('command -v '.$conf['ext_imagick_dir'].'magick', $cmd_out , $retval ); if (0 == $retval) { $page['ext_imagick_command'] = 'magick'; } else { $page['ext_imagick_command'] = 'convert'; } } return $page['ext_imagick_command']; } ``` After this change the external ImageMagick is shown. Thank you. <!-- github-sync-id:3668675503 -->
adam closed this issue 2026-10-05 01:07:30 +02:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#2139