photos_add page not finding ImageMagick, returns 'GD library is missing'. #846

Open
opened 2026-10-05 00:20:27 +02:00 by adam · 10 comments
Owner

Newly installed, Piwigo 2.9.4
ImageMagick 7.0.8-23 was properly installed after the install of Piwigo.
(GD Library was never installed on this Ubuntu system).
All other image functionality works fine in this Piwigo installation.

Newly installed, Piwigo 2.9.4 ImageMagick 7.0.8-23 was properly installed _after_ the install of Piwigo. (GD Library was never installed on this Ubuntu system). All other image functionality works fine in this Piwigo installation. <!-- github-sync-id:397430040 -->
Author
Owner

@plegall why is there that error reporting https://github.com/Piwigo/Piwigo/blob/master/admin/include/photos_add_direct_prepare.inc.php#L176 while there is a check there https://github.com/Piwigo/Piwigo/blob/master/admin/include/photos_add_direct_prepare.inc.php#L36
Is GD library really mandatory? I only remember that GD is used if the pictures are resized after upload

@plegall why is there that error reporting https://github.com/Piwigo/Piwigo/blob/master/admin/include/photos_add_direct_prepare.inc.php#L176 while there is a check there https://github.com/Piwigo/Piwigo/blob/master/admin/include/photos_add_direct_prepare.inc.php#L36 Is GD library really mandatory? I only remember that GD is used if the pictures are resized after upload <!-- github-comment-id:452747719 -->
Author
Owner

I remember GD is mandatory to read EXIF metadata. But I may be wrong!

I remember GD is mandatory to read EXIF metadata. But I may be wrong! <!-- github-comment-id:452750471 -->
Author
Owner

it is to keep metadata when resizing
but to read exif that's just https://github.com/Piwigo/Piwigo/blob/b9336d7117770e304197a3afad1068eea5491a29/include/functions_metadata.inc.php#L141 -> http://php.net/manual/fr/function.exif-read-data.php (btw php 7.2 improved the readibility of exfis data nice!)

it is to keep metadata when resizing but to read exif that's just https://github.com/Piwigo/Piwigo/blob/b9336d7117770e304197a3afad1068eea5491a29/include/functions_metadata.inc.php#L141 -> http://php.net/manual/fr/function.exif-read-data.php (btw php 7.2 improved the readibility of exfis data nice!) <!-- github-comment-id:452775719 -->
Author
Owner

I notice that there was once a vulnerability in Imagemagick that would be exploited during the photo_add step - https://www.theregister.co.uk/2016/05/03/imagemagick/

I notice that there was once a vulnerability in Imagemagick that would be exploited during the photo_add step - https://www.theregister.co.uk/2016/05/03/imagemagick/ <!-- github-comment-id:453015708 -->
Author
Owner

it is to keep metadata when resizing

I don't think so. I've made some search on the forum and I said a while back that GD was removing metadata when resizing.

Maybe GD is not really mandatory. What's mandatory is to have either GD or imagemagick. I've always considered GD was coming automatically with PHP. Here is maybe my mistake because today you can perfectly install PHP without GD and have ImageMagick which should be fine.

I'll make some tests without GD and only ImageMagick and if everything works fine, I'll change the condition from "is GD installed" to "is GD or ImageMagick installed".

> it is to keep metadata when resizing I don't think so. I've made some search on the forum and I said a while back that GD was removing metadata when resizing. Maybe GD is not really mandatory. What's mandatory is to have either GD or imagemagick. I've always considered GD was coming automatically with PHP. Here is maybe my mistake because today you can perfectly install PHP without GD and have ImageMagick which should be fine. I'll make some tests without GD and only ImageMagick and if everything works fine, I'll change the condition from "is GD installed" to "is GD or ImageMagick installed". <!-- github-comment-id:453067082 -->
Author
Owner

To get going with this, can I make a simple file change?
I am concerned that if I install GD, then this library may be selected over the ImageMagick library in other parts of the programme.
It would be hard to tell, just as in this case.

To get going with this, can I make a simple file change? I am concerned that if I install GD, then this library may be selected over the ImageMagick library in other parts of the programme. It would be hard to tell, just as in this case. <!-- github-comment-id:454057956 -->
Author
Owner

You can force which one to use through the variables in the local config.
Check out website for doc forum etc

Le 14 janv. 2019 17:02, "ronankeane" notifications@github.com a écrit :

To get going with this, can I make a simple file change?
I am concerned that if I install GD, then this library may be selected over
the ImageMagick library in other parts of the programme.
It would be hard to tell, just as in this case.

—
You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/Piwigo/Piwigo/issues/957#issuecomment-454057956, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAs-jTW1gAP46r7hoSGDEpqyf8mAe76jks5vDKolgaJpZM4Z3vvL
.

You can force which one to use through the variables in the local config. Check out website for doc forum etc Le 14 janv. 2019 17:02, "ronankeane" <notifications@github.com> a écrit : To get going with this, can I make a simple file change? I am concerned that if I install GD, then this library may be selected over the ImageMagick library in other parts of the programme. It would be hard to tell, just as in this case. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <https://github.com/Piwigo/Piwigo/issues/957#issuecomment-454057956>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAs-jTW1gAP46r7hoSGDEpqyf8mAe76jks5vDKolgaJpZM4Z3vvL> . <!-- github-comment-id:454067820 -->
Author
Owner

As found by @Teatek in #976 it's possible to use Piwigo without GD, but it will fail for GIF files (animated or not). We need to change some code to adapt ImageMagick command lines to handle static and animated gif files. As said by @mistic100 on https://piwigo.org/forum/viewtopic.php?pid=151293#p151293 and mentioned by Teatek, I agree we would need an option to disable animation on small resized GIF (maybe reusing $conf['derivatives_strip_metadata_threshold'])

As found by @Teatek in #976 it's possible to use Piwigo without GD, but it will fail for GIF files (animated or not). We need to change some code to adapt ImageMagick command lines to handle static and animated gif files. As said by @mistic100 on https://piwigo.org/forum/viewtopic.php?pid=151293#p151293 and mentioned by Teatek, I agree we would need an option to disable animation on small resized GIF (maybe reusing `$conf['derivatives_strip_metadata_threshold']`) <!-- github-comment-id:462033343 -->
Author
Owner

I got around to installing the GD library to make the photos_add page work. A couple of issues.

  1. While the photos_add page now works fine, it displays a message --- Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/photos/piwigo/_data/templates_c/p6jhns^561a9bf60ffeeda8e86a99ad26c0ec6395fd8cf0_0.file.photos_add_direct.tpl.php on line 327
    (note my userlist.tpl is updated as per fix https://github.com/Piwigo/Piwigo/issues/887)

  2. I specified $conf['graphics_library'] = 'imagick'; in local config file, but (a) having read your documentation I am unclear as to correct use of 'imagick' or 'ext_imagick', (b) I do not see where I can check and confirm which library is actually being used.

I got around to installing the GD library to make the photos_add page work. A couple of issues. 1. While the photos_add page now works fine, it displays a message --- Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/photos/piwigo/_data/templates_c/p6jhns^561a9bf60ffeeda8e86a99ad26c0ec6395fd8cf0_0.file.photos_add_direct.tpl.php on line 327 (note my userlist.tpl is updated as per fix https://github.com/Piwigo/Piwigo/issues/887) 2. I specified $conf['graphics_library'] = 'imagick'; in local config file, but (a) having read your documentation I am unclear as to correct use of 'imagick' or 'ext_imagick', (b) I do not see where I can check and confirm which library is actually being used. <!-- github-comment-id:468607982 -->
Author
Owner

In admin/include/photos_add_direct_prepare.inc.php if I replace:

if (!function_exists('gd_info'))
 {
  $setup_errors[] = l10n('GD library is missing');
 }

by

if (!pwg_image::get_library())
{
  $setup_errors[] = 'GD or ImageMagick is missing';
}

then it works fine BUT it fails at generating multiple sizes for GIF files.

In `admin/include/photos_add_direct_prepare.inc.php` if I replace: ``` if (!function_exists('gd_info')) { $setup_errors[] = l10n('GD library is missing'); } ``` by ``` if (!pwg_image::get_library()) { $setup_errors[] = 'GD or ImageMagick is missing'; } ``` then it works fine BUT it fails at generating multiple sizes for GIF files. <!-- github-comment-id:946667227 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#846