Thumbnail Generation went away with Command line ImageMagick

Hello, we had omeka s running for a while with thumbnails being created for images only with the following configuration:

<?php
return [
    'logger' => [
        'log' => true,
        'priority' => \Zend\Log\Logger::NOTICE,
        'path' => '/data/logs/omeka',
    ],
    'http_client' => [
        'sslcapath' => '/etc/apache2/ssl',
        'sslcafile' => '/etc/apache2/ssl/ibali_uct_ac_za_interm.cer',
    ],
    'cli' => [
        'phpcli_path' => null,
    ],
    'thumbnails' => [
        'types' => [
            'large' => ['constraint' => 800],
            'medium' => ['constraint' => 200],
            'square' => ['constraint' => 200],
        ],
        'thumbnailer_options' => [
            'imagemagick_dir' => null,
     ],
    ],
    'translator' => [
        'locale' => 'en_US',
    ],
    'service_manager' => [
        'aliases' => [
            'Omeka\File\Store' => 'Omeka\File\Store\Local',
            'Omeka\File\Thumbnailer' => 'Omeka\File\Thumbnailer\ImageMagick',
        ],
    ],
];

However, we wanted to add the option of creating thumbnails from PDFs and other media so I requested for our IT department to install ImageMagick.

which seems to have worked out fine.

Running which magick

root@devubuomk001:/data/www/omeka-s/config# which magick
/usr/local/bin/magick

So now we have a config file that looks like this

<?php
return [
    'logger' => [
        'log' => true,
        'priority' => \Zend\Log\Logger::NOTICE,
        'path' => '/data/logs/omeka',
    ],
    'http_client' => [
        'sslcapath' => '/etc/apache2/ssl',
        'sslcafile' => '/etc/apache2/ssl/ibali_uct_ac_za_interm.cer',
    ],
    'cli' => [
        'phpcli_path' => null,
    ],
    'thumbnails' => [
        'types' => [
            'large' => ['constraint' => 800],
            'medium' => ['constraint' => 200],
            'square' => ['constraint' => 200],
        ],
        'thumbnailer_options' => [
            'imagemagick_dir' => '/usr/local/bin',
     ],
    ],
    'translator' => [
        'locale' => 'en_US',
    ],
    'service_manager' => [
        'aliases' => [
            'Omeka\File\Store' => 'Omeka\File\Store\Local',
            'Omeka\File\Thumbnailer' => 'Omeka\File\Thumbnailer\ImageMagick',
        ],
    ],
];

However, when we upload media we only get icons

with the following error

Command “/usr/local/bin/convert -density 150 ‘/data/www/omeka-s/sideload/C2500090408_web.pdf[0]’ -auto-orient -background white +repage -alpha remove -thumbnail ‘800x800>’ ‘/tmp/omekawWoM9l.jpg’” failed with status code 1.

Any ideas on what we could be doing wrong?

Sanjin

So, your first configuration shows that you already had ImageMagick, is that correct? At /usr/bin maybe?

It looks like there’s just some issue with your new installation of it… like perhaps it does not have JPEG support or something like that so it cannot write the thumbnails? (you could check this kind of thing with /usr/local/bin/convert -list format )

If you already had ImageMagick before this recent change of yours, generating PDFs would be a matter of making sure you have Ghostscript installed and that ImageMagick isn’t configured to block PDF generation in its policy.xml file.

Hello, thanks for the quick response.

I am actually not sure if we did have ImageMagick set up before this change unless it came with the standard ubuntu installation (complete newbies when we first installed it). The path was null up until this time, but if I understand correctly our last line "‘Omeka\File\Thumbnailer\ImageMagick’ indicates that we were using command line ImageMagick all along? And now by installing it again and putting in a path, we have kind of messed that up?

I will ask our IT department to run through the check for JPEG format, and perhaps go back to null path? I will also double check the policy.xml file.

Thanks again

Hello again,

So we went through a did what you suggested @jflatnes. From our IT department “ghost script in installed, and ImageMagick is now configured to allow PDF generation in its policy.xml file.” We also ran the command on imagemagick and got the result below.

However, when adding new items, we are still not getting a thumbnail and we are getting the error

Command "/usr/local/bin/convert -density 150 '/data/www/omeka-s/sideload/C2500090408_web.pdf[0]' -auto-orient -background white +repage -alpha remove -thumbnail '800x800>' '/tmp/omekaGJ4UDT.jpg'" failed with status code 1.

If as you said, we had it working before, I wonder if change the code in the config file so that instead of

  'thumbnailer_options' => [
            'imagemagick_dir' => '/usr/local/bin',
     ],

we go back to

  'thumbnailer_options' => [
            'imagemagick_dir' => null,
     ],

if that would work, but from reading documentation that doesn’t make sense to me, for how does Omeka know the path?

The result of our /usr/local/bin/convert -list format is:

{\rtf1\ansi\ansicpg1252\cocoartf2513
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\*\expandedcolortbl;;}
\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0

\f0\fs24 \cf0 root@devubuomk001:~/ImageMagick-7.0.10# /usr/local/bin/convert -list format\
   Format  Mode  Description\
-------------------------------------------------------------------------------\
      3FR  r--   Hasselblad CFV/H3D39II\
      3G2  r--   Media Container\
      3GP  r--   Media Container\
        A* rw+   Raw alpha samples\
      AAI* rw+   AAI Dune image\
       AI  rw-   Adobe Illustrator CS2\
     APNG  rw+   Animated Portable Network Graphics\
      ART* rw-   PFS: 1st Publisher Clip Art\
      ARW  r--   Sony Alpha Raw Image Format\
   ASHLAR* -w+   Image sequence laid out in continuous irregular courses\
      AVI  r--   Microsoft Audio/Visual Interleaved\
      AVS* rw+   AVS X image\
        B* rw+   Raw blue samples\
      BGR* rw+   Raw blue, green, and red samples\
     BGRA* rw+   Raw blue, green, red, and alpha samples\
     BGRO* rw+   Raw blue, green, red, and opacity samples\
      BMP* rw-   Microsoft Windows bitmap image\
     BMP2* rw-   Microsoft Windows bitmap image (V2)\
     BMP3* rw-   Microsoft Windows bitmap image (V3)\
      BRF* -w-   BRF ASCII Braille format\
        C* rw+   Raw cyan samples\
      CAL* r--   Continuous Acquisition and Life-cycle Support Type 1\
           Specified in MIL-R-28002 and MIL-PRF-28002\
     CALS* r--   Continuous Acquisition and Life-cycle Support Type 1\
           Specified in MIL-R-28002 and MIL-PRF-28002\
   CANVAS* r--   Constant image uniform color\
  CAPTION* r--   Caption\
      CIN* rw-   Cineon Image File\
      CIP* -w-   Cisco IP phone image format\
     CLIP* rw+   Image Clip Mask\
     CMYK* rw+   Raw cyan, magenta, yellow, and black samples\
    CMYKA* rw+   Raw cyan, magenta, yellow, black, and alpha samples\
      CR2  r--   Canon Digital Camera Raw Image Format\
      CR3  r--   Canon Digital Camera Raw Image Format\
      CRW  r--   Canon Digital Camera Raw Image Format\
     CUBE* r--   Cube LUT\
      CUR* rw-   Microsoft icon\
      CUT* r--   DR Halo\
     DATA* rw+   Base64-encoded inline images\
      DCM* r--   Digital Imaging and Communications in Medicine image\
           DICOM is used by the medical community for images like X-rays.  The\
           specification, "Digital Imaging and Communications in Medicine\
           (DICOM)", is available at http://medical.nema.org/.  In particular,\
           see part 5 which describes the image encoding (RLE, JPEG, JPEG-LS),\
           and supplement 61 which adds JPEG-2000 encoding.\
      DCR  r--   Kodak Digital Camera Raw Image File\
    DCRAW  r--   Raw Photo Decoder (dcraw)\
      DCX* rw+   ZSoft IBM PC multi-page Paintbrush\
      DDS* rw+   Microsoft DirectDraw Surface\
      DNG  r--   Digital Negative\
      DPX* rw-   SMPTE 268M-2003 (DPX 2.0)\
           Digital Moving Picture Exchange Bitmap, Version 2.0.\
           See SMPTE 268M-2003 specification at http://www.smtpe.org\
\
     DXT1* rw+   Microsoft DirectDraw Surface\
     DXT5* rw+   Microsoft DirectDraw Surface\
     EPDF  rw-   Encapsulated Portable Document Format\
      EPI  rw-   Encapsulated PostScript Interchange format\
      EPS  rw-   Encapsulated PostScript\
     EPS2  -w-   Level II Encapsulated PostScript\
     EPS3  -w+   Level III Encapsulated PostScript\
     EPSF  rw-   Encapsulated PostScript\
     EPSI  rw-   Encapsulated PostScript Interchange format\
      ERF  r--   Epson RAW Format\
 FARBFELD* rw-   Farbfeld\
      FAX* rw+   Group 3 FAX\
           FAX machines use non-square pixels which are 1.5 times wider than\
           they are tall but computer displays use square pixels, therefore\
           FAX images may appear to be narrow unless they are explicitly\
           resized using a geometry of "150x100%".\
\
       FF* rw-   Farbfeld\
     FILE* r--   Uniform Resource Locator (file://)\
     FITS* rw-   Flexible Image Transport System\
     FL32* rw-   FilmLight\
      FLV  rw+   Flash Video Stream\
  FRACTAL* r--   Plasma fractal image\
      FTP* ---   Uniform Resource Locator (ftp://)\
      FTS* rw-   Flexible Image Transport System\
        G* rw+   Raw green samples\
       G3* rw-   Group 3 FAX\
       G4* rw-   Group 4 FAX\
      GIF* rw+   CompuServe graphics interchange format\
    GIF87* rw-   CompuServe graphics interchange format (version 87a)\
 GRADIENT* r--   Gradual linear passing from one shade to another\
     GRAY* rw+   Raw gray samples\
    GRAYA* rw+   Raw gray and alpha samples\
     HALD* r--   Identity Hald color lookup table image\
      HDR* rw+   Radiance RGBE image format\
HISTOGRAM* -w-   Histogram of the image\
      HRZ* rw-   Slow Scan TeleVision\
      HTM* -w-   Hypertext Markup Language and a client-side image map\
     HTML* -w-   Hypertext Markup Language and a client-side image map\
     HTTP* ---   Uniform Resource Locator (http://)\
    HTTPS* r--   Uniform Resource Locator (https://)\
      ICB* rw-   Truevision Targa image\
      ICO* rw+   Microsoft icon\
     ICON* rw-   Microsoft icon\
      IIQ  r--   Phase One Raw Image Format\
     INFO  -w+   The image format and characteristics\
   INLINE* rw+   Base64-encoded inline images\
      IPL* rw+   IPL Image Sequence\
   ISOBRL* -w-   ISO/TR 11548-1 format\
  ISOBRL6* -w-   ISO/TR 11548-1 format 6dot\
      JNX* r--   Garmin tile format\
     JSON  -w+   The image format and characteristics\
        K* rw+   Raw black samples\
      K25  r--   Kodak Digital Camera Raw Image Format\
      KDC  r--   Kodak Digital Camera Raw Image Format\
    LABEL* r--   Image label\
        M* rw+   Raw magenta samples\
      M2V  rw+   MPEG Video Stream\
      M4V  rw+   Raw VIDEO-4 Video\
      MAC* r--   MAC Paint\
      MAP* rw-   Colormap intensities and indices\
     MASK* rw+   Image Clip Mask\
      MAT  rw+   MATLAB level 5 image format\
    MATTE* -w+   MATTE format\
      MEF  r--   Mamiya Raw Image File\
     MIFF* rw+   Magick Image File Format\
      MKV  rw+   Multimedia Container\
     MONO* rw-   Raw bi-level bitmap\
      MOV  rw+   MPEG Video Stream\
      MP4  rw+   VIDEO-4 Video Stream\
      MPC* rw+   Magick Persistent Cache image format\
     MPEG  rw+   MPEG Video Stream\
      MPG  rw+   MPEG Video Stream\
      MRW  r--   Sony (Minolta) Raw Image File\
      MSL* ---   Magick Scripting Language\
     MSVG* -w+   ImageMagick's own SVG internal renderer\
      MTV* rw+   MTV Raytracing image format\
      MVG* rw-   Magick Vector Graphics\
      NEF  r--   Nikon Digital SLR Camera Raw Image File\
      NRW  r--   Nikon Digital SLR Camera Raw Image File\
     NULL* rw-   Constant image of uniform color\
        O* rw+   Raw opacity samples\
      ORA  ---   OpenRaster format\
      ORF  r--   Olympus Digital Camera Raw Image File\
      OTB* rw-   On-the-air bitmap\
      PAL* rw-   16bit/pixel interleaved YUV\
     PALM* rw+   Palm pixmap\
      PAM* rw+   Common 2-dimensional bitmap format\
    PANGO* ---   Pango Markup Language\
  PATTERN* r--   Predefined pattern\
      PBM* rw+   Portable bitmap format (black and white)\
      PCD* rw-   Photo CD\
     PCDS* rw-   Photo CD\
      PCL  rw+   Printer Control Language\
      PCT* rw-   Apple Macintosh QuickDraw/PICT\
      PCX* rw-   ZSoft IBM PC Paintbrush\
      PDB* rw+   Palm Database ImageViewer Format\
      PDF  rw+   Portable Document Format\
     PDFA  rw+   Portable Document Archive Format\
      PEF  r--   Pentax Electronic File\
      PES* r--   Embrid Embroidery Format\
      PFM* rw+   Portable float format\
      PGM* rw+   Portable graymap format (gray scale)\
      PGX* rw-   JPEG 2000 uncompressed format\
      PHM* rw+   Portable half float format\
    PICON* rw-   Personal Icon\
     PICT* rw-   Apple Macintosh QuickDraw/PICT\
      PIX* r--   Alias/Wavefront RLE image format\
   PLASMA* r--   Plasma fractal image\
      PNM* rw+   Portable anymap\
POCKETMOD  rw+   Pocketmod Personal Organizer\
      PPM* rw+   Portable pixmap format (color)\
       PS  rw+   PostScript\
      PS2  -w+   Level II PostScript\
      PS3  -w+   Level III PostScript\
      PSB* rw+   Adobe Large Document Format\
      PSD* rw+   Adobe Photoshop bitmap\
      PWP* r--   Seattle Film Works\
        R* rw+   Raw red samples\
RADIAL-GRADIENT* r--   Gradual radial passing from one shade to another\
      RAF  r--   Fuji CCD-RAW Graphic File\
      RAS* rw+   SUN Rasterfile\
      RAW  r--   Raw\
      RGB* rw+   Raw red, green, and blue samples\
   RGB565* r--   Raw red, green, blue samples in 565 format\
     RGBA* rw+   Raw red, green, blue, and alpha samples\
     RGBO* rw+   Raw red, green, blue, and opacity samples\
      RGF* rw-   LEGO Mindstorms EV3 Robot Graphic Format (black and white)\
      RLA* r--   Alias/Wavefront image\
      RLE* r--   Utah Run length encoded image\
      RMF  r--   Raw Media Format\
      RW2  r--   Panasonic Lumix Raw Image\
      SCR* r--   ZX-Spectrum SCREEN$\
SCREENSHOT* r--   Screen shot\
      SCT* r--   Scitex HandShake\
      SFW* r--   Seattle Film Works\
      SGI* rw+   Irix RGB image\
    SHTML* -w-   Hypertext Markup Language and a client-side image map\
      SIX* rw-   DEC SIXEL Graphics Format\
    SIXEL* rw-   DEC SIXEL Graphics Format\
SPARSE-COLOR* -w+   Sparse Color\
      SR2  r--   Sony Raw Format 2\
      SRF  r--   Sony Raw Format\
  STEGANO* r--   Steganographic image\
      SUN* rw+   SUN Rasterfile\
      SVG* rw+   Scalable Vector Graphics\
     SVGZ* -w+   Compressed Scalable Vector Graphics\
     TEXT* r--   Text\
      TGA* rw-   Truevision Targa image\
THUMBNAIL* -w+   EXIF Profile Thumbnail\
     TILE* r--   Tile image with a texture\
      TIM* r--   PSX TIM\
      TM2* r--   PS2 TIM2\
      TXT* rw+   Text\
     UBRL* -w-   Unicode Text format\
    UBRL6* -w-   Unicode Text format 6dot\
      UIL* -w-   X-Motif UIL table\
     UYVY* rw-   16bit/pixel interleaved YUV\
      VDA* rw-   Truevision Targa image\
    VICAR* rw-   VICAR rasterfile format\
      VID* rw+   Visual Image Directory\
     VIFF* rw+   Khoros Visualization image\
     VIPS* rw+   VIPS image\
      VST* rw-   Truevision Targa image\
     WBMP* rw-   Wireless Bitmap (level 0) image\
     WEBM  rw+   Open Web Media\
      WMV  rw+   Windows Media Video\
      WPG* r--   Word Perfect Graphics\
      X3F  r--   Sigma Camera RAW Picture File\
      XBM* rw-   X Windows system bitmap (black and white)\
       XC* r--   Constant image uniform color\
      XCF* r--   GIMP image\
      XPM* rw-   X Windows system pixmap (color)\
      XPS  r--   Microsoft XML Paper Specification\
       XV* rw+   Khoros Visualization image\
        Y* rw+   Raw yellow samples\
     YAML  -w+   The image format and characteristics\
    YCbCr* rw+   Raw Y, Cb, and Cr samples\
   YCbCrA* rw+   Raw Y, Cb, Cr, and alpha samples\
      YUV* rw-   CCIR 601 4:1:1 or 4:2:2\
\
* native blob support\
r read support\
w write support\
+ support for multiple images\
root@devubuomk001:~/ImageMagick-7.0.10#\
}

Thanks for your help.

Your issue seems to be just as I suspected: your “new” ImageMagick isn’t built to support JPEG images at all, nor a variety of other common formats. You likely needed the development libraries of the various image codec libraries if you wanted to build it to work more normally.

A more “typical” ImageMagick installation would have lines in that output like these:

  JPE* JPEG      rw-   Joint Photographic Experts Group JFIF format (libjpeg-turbo 2.0.3)
 JPEG* JPEG      rw-   Joint Photographic Experts Group JFIF format (libjpeg-turbo 2.0.3)
  JPG* JPEG      rw-   Joint Photographic Experts Group JFIF format (libjpeg-turbo 2.0.3)
  JPS* JPEG      rw-   Joint Photographic Experts Group JFIF format (libjpeg-turbo 2.0.3)

But, yes, if you do have a “normal” ImageMagick already installed, then you could just go back to that one. I imagine it’s located at /usr/bin/convert if it exists. As for how Omeka can use it: the default is for us to look for a “convert” command on the binary path for the server (the PATH environment variable) and use that. For most servers this just automatically detects the proper location of the ImageMagick install and doesn’t require manually setting anything.

Note, by installing another ImageMagick in /usr/local, you may have made it the one that would be auto-detected now. If this is an issue you could uninstall your “new” ImageMagick, or manually specify the path to the old one in the config file similar to how you’re doing it now.

Dear @jflatnes thanks so much for this and clearing up the whole null issue. I have forwarded your comments to the IT department to have a look and see what they can do. I would try to put it back to NULL and see what happens.
Going on Omeka S I did suddenly this this which I had not seen before we had tried to install another ImageMagic, and I am wondering if it is also part of the puzzle and if it points to what you had described as the error.

The message you’re seeing there is just because you’ve (mistakenly?) put an ImageMagick folder inside the modules folder of your Omeka S install. You could just move or delete that folder.

thanks @jflatnes I will tell our IT department to remove that.

In the meantime they have told me that they have removed the new version of imagemagic, however we are running now into the error below if we keep the path in our config.php file as “/usr/local/bin”

Omeka\File\Exception\InvalidThumbnailerException: ImageMagick error: invalid ImageMagick command. in /data/www/omeka-s/application/src/File/Thumbnailer/ImageMagick.php:108
Stack trace:
#0 /data/www/omeka-s/application/src/File/Thumbnailer/ImageMagick.php(41): Omeka\File\Thumbnailer\ImageMagick->setConvertPath('/usr/local/bin')
#1 /data/www/omeka-s/application/src/File/TempFile.php(264): Omeka\File\Thumbnailer\ImageMagick->setOptions(Array)
#2 /data/www/omeka-s/application/src/File/TempFile.php(438): Omeka\File\TempFile->storeThumbnails()
#3 /data/www/omeka-s/modules/FileSideload/src/Media/Ingester/Sideload.php(84): Omeka\File\TempFile->mediaIngestFile(Object(Omeka\Entity\Media), Object(Omeka\Api\Request), Object(Omeka\Stdlib\ErrorStore), true, true, false, true)
#4 /data/www/omeka-s/application/src/Api/Adapter/MediaAdapter.php(145): FileSideload\Media\Ingester\Sideload->ingest(Object(Omeka\Entity\Media), Object(Omeka\Api\Request), Object(Omeka\Stdlib\ErrorStore))
#5 /data/www/omeka-s/application/src/Api/Adapter/AbstractEntityAdapter.php(548): Omeka\Api\Adapter\MediaAdapter->hydrate(Object(Omeka\Api\Request), Object(Omeka\Entity\Media), Object(Omeka\Stdlib\ErrorStore))
#6 /data/www/omeka-s/application/src/Api/Adapter/ItemAdapter.php(190): Omeka\Api\Adapter\AbstractEntityAdapter->hydrateEntity(Object(Omeka\Api\Request), Object(Omeka\Entity\Media), Object(Omeka\Stdlib\ErrorStore))
#7 /data/www/omeka-s/application/src/Api/Adapter/AbstractEntityAdapter.php(548): Omeka\Api\Adapter\ItemAdapter->hydrate(Object(Omeka\Api\Request), Object(Omeka\Entity\Item), Object(Omeka\Stdlib\ErrorStore))
#8 /data/www/omeka-s/application/src/Api/Adapter/AbstractEntityAdapter.php(276): Omeka\Api\Adapter\AbstractEntityAdapter->hydrateEntity(Object(Omeka\Api\Request), Object(Omeka\Entity\Item), Object(Omeka\Stdlib\ErrorStore))
#9 /data/www/omeka-s/application/src/Api/Manager.php(224): Omeka\Api\Adapter\AbstractEntityAdapter->create(Object(Omeka\Api\Request))
#10 /data/www/omeka-s/application/src/Api/Manager.php(78): Omeka\Api\Manager->execute(Object(Omeka\Api\Request))
#11 /data/www/omeka-s/application/src/Mvc/Controller/Plugin/Api.php(99): Omeka\Api\Manager->create('items', Array, Array, Array)
#12 /data/www/omeka-s/application/src/Controller/Admin/ItemController.php(205): Omeka\Mvc\Controller\Plugin\Api->create('items', Array, Array)
#13 /data/www/omeka-s/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(78): Omeka\Controller\Admin\ItemController->addAction()
#14 /data/www/omeka-s/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#15 /data/www/omeka-s/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#16 /data/www/omeka-s/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(106): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#17 /data/www/omeka-s/vendor/zendframework/zend-mvc/src/DispatchListener.php(138): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#18 /data/www/omeka-s/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#19 /data/www/omeka-s/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#20 /data/www/omeka-s/vendor/zendframework/zend-mvc/src/Application.php(332): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#21 /data/www/omeka-s/index.php(21): Zend\Mvc\Application->run()
#22 {main}

if we go back to setting the 'imagemagick_dir to NULL instead of of /usr/local/bin then we go back to being able to create thumbnails from JPGS, but not from PDFs or from Films (even though we have installed ghost script and FFMPEG).
Did we not manage to update the original imagemagick for Omeka to be able to see it? Or do we need to repeat the changes made to ghostscript POLICY files for the original imagemagick?
or did we just tottally mess up our imagemagick server stuff.

root@devubuomk001:/home# cd ImageMagick-7.0.10/

root@devubuomk001:/home/ImageMagick-7.0.10# which magick

root@devubuomk001:/home/ImageMagick-7.0.10# which convert

/usr/bin/convert

root@devubuomk001:/home/ImageMagick-7.0.10# 

root@devubuomk001:/home/ImageMagick-7.0.10#

Sorry about this and thanks for patience and willingness to help out

hello again @jflatnes

this is the code we used to build the imagemagick

    mkdir $HOME/imagemagick_build && cd $HOME/imagemagick_build && \
wget https://download.imagemagick.org/ImageMagick/download/ImageMagick-7.0.10-61.tar.bz2 && \
tar xvf ImageMagick-7.0.10-61.tar.bz2 && cd ImageMagick-7.0.10-61 && \
./configure --with-rsvg && make && \
sudo checkinstall -D --install=yes --fstrans=no --pakdir "$HOME/imagemagick_build" \
     --pkgname imagemagick --backup=no --deldoc=yes --deldesc=yes --delspec=yes --default \
     --pkgversion "7.0.10-61" && \
make distclean && sudo ldconfig

and we removed the native one
apt remove imagemagick

should we rebuild the native one instead and add the ghostscript and ffmpeg to it?
thanks

It’s probably better to use the distro-packaged ImageMagick you were using before.

You can build it from source, but you’ll need to have development libraries for all sorts of things installed first to build it in any kind of useful configuration. It’s probably not worth the trouble. The distribution-provided ImageMagick should be perfectly capable of working with PDFs as long as ghostscript is installed and the policy.xml file allows it.

You might want to make uninstall or whatever is the appropriate method to remove your built version from /usr/local also.

When you’ve done this, removed the new one and reinstalled the regular one, just leaving the configured path as “null” as before should be fine (and setting to /usr/local/bin won’t work).

Dear @jflatnes

Thanks so much we followed your steps and it has worked! (ok partially) we are now getting images and PDFs to make thumbnails without a problem. However we are struggling with thumbnails from videos and wondering if you have advice for that. I know you said that if FFMPEG is installed it should just pick it up, and we do have it installed but it doesn’t seem to be working.

It seems that importing from YouTube generates a thumbnail without a problem


but not an Mp4

root@devubuomk001:/etc/ImageMagick-6# nano policy.xml 

  GNU nano 2.9.3                                                     policy.xml                                                               
  <!-- <policy domain="resource" name="thread" value="4"/> -->
  <!-- <policy domain="resource" name="throttle" value="0"/> -->
  <!-- <policy domain="resource" name="time" value="3600"/> -->
  <!-- <policy domain="system" name="precision" value="6"/> -->
  <!-- not needed due to the need to use explicitly by mvg: -->
  <!-- <policy domain="delegate" rights="none" pattern="MVG" /> -->
  <!-- use curl -->
  <policy domain="delegate" rights="none" pattern="URL" />
  <policy domain="delegate" rights="none" pattern="HTTPS" />
  <policy domain="delegate" rights="read | write" pattern="mpeg:decode" />
  <policy domain="delegate" rights="none" pattern="HTTP" />

  <!-- in order to avoid to get image with password text -->
  <policy domain="path" rights="none" pattern="@*"/>
  <policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/>
  <!-- disable ghostscript format types -->
  <policy domain="coder" rights="read | write" pattern="PS" />
  <policy domain="coder" rights="read | write" pattern="PS2" />
  <policy domain="coder" rights="read | write" pattern="PS3" />
  <policy domain="coder" rights="read | write" pattern="EPS" />
  <policy domain="coder" rights="read | write" pattern="PDF" />
  <policy domain="coder" rights="read | write" pattern="XPS" />
  <policy domain="coder" rights="read | write" pattern="MP4" />
</policymap>

Our IT department has included the next two lines but it has not been able to change anything:

<policy domain="coder" rights="read | write" pattern="MP4" />
<policy domain="delegate" rights="read | write" pattern="mpeg:decode" />

Thanks again for your help

The best way to check on what’s happening with ImageMagick is usually just to try it out on the terminal and see what it reports.

Upload a test mp4 to your server and run

convert -verbose "test.mp4[0]" test.jpg

and see what happens. If it’s not working, you should get some kind of error output from ImageMagick explaining the issue.

Thanks @jflatnes

I realize i might have to go an imagemagick forum, but this is the error we got, if you can point us towards any assistance

root@devubuomk001:/usr/bin# convert -verbose "UCTs Library and Information Studies Centre LISC_1080p.mp4[0]" test.jpg
convert-im6.q16: not authorized `mpeg:decode' @ error/delegate.c/InvokeDelegate/1717.
convert-im6.q16: unable to open image `.pam': No such file or directory @ error/blob.c/OpenBlob/2701.
convert-im6.q16: unable to open image `.pam': No such file or directory @ error/blob.c/OpenBlob/2701.
convert-im6.q16: no images defined `test.jpg' @ error/convert.c/ConvertImageCommand/3258.
root@devubuomk001:/usr/bin# mc

 

root@devubuomk001:/usr/bin# convert -verbose "library.mp4[0]" test.jpg
convert-im6.q16: not authorized `mpeg:decode' @ error/delegate.c/InvokeDelegate/1717.
convert-im6.q16: unable to open image `.pam': No such file or directory @ error/blob.c/OpenBlob/2701.
convert-im6.q16: unable to open image `.pam': No such file or directory @ error/blob.c/OpenBlob/2701.
convert-im6.q16: no images defined `test.jpg' @ error/convert.c/ConvertImageCommand/3258.
root@devubuomk001:/usr/bin#

this is our policy

root@devubuomk001:/usr/bin# identify -list policy

Path: /etc/ImageMagick-6/policy.xml

  Policy: Resource
    name: disk
    value: 1GiB
  Policy: Resource
    name: map
    value: 512MiB
  Policy: Resource
    name: memory
    value: 256MiB
  Policy: Resource
    name: area
    value: 128MB
  Policy: Resource
    name: height
    value: 16KP
  Policy: Resource
    name: width
    value: 16KP
  Policy: Delegate
    rights: Read Write 
    pattern: mpeg:decode
  Policy: Delegate
    rights: None 
    pattern: URL
  Policy: Delegate
    rights: None 
    pattern: HTTPS
  Policy: Delegate
    rights: None 
    pattern: HTTP
  Policy: Path
    rights: None 
    pattern: @*
  Policy: Coder
    rights: Read Write 
    pattern: PS
  Policy: Coder
    rights: Read Write 
    pattern: PS2
  Policy: Coder
    rights: Read Write 
    pattern: PS3
  Policy: Coder
    rights: Read Write 
    pattern: EPS
  Policy: Coder
    rights: Read Write 
    pattern: PDF
  Policy: Coder
    rights: Read Write 
    pattern: XPS
  Policy: Coder
    rights: Read Write 
    pattern: {​​​​​​​​GIF,JPEG,PNG,WEBP,MP4}​​​​​​​​
Path: [built-in]

  Policy: Undefined
    rights: None 
root@devubuomk001:/usr/bin# 


thanks again

The “not authorized” output means it’s a policy issue, I think.

I haven’t played around much with the delegate policies, but perhaps the relevant permission you’re not granting for mpeg:decode is execute.

Hi,

I was having the same issue. The solution who work in my case is to modify my local.config.php file as explain in this topic : Thumbnails are not generated

Hi @Fred thanks, i did have a look at that thread as well, but when we changed it it seems to have switched over to the PHP extension of Imagemagick which we dont have, and kept giving errors as well. Did yours work out find, and was that the PHP version as I read from that thread (or it might have been from another related one by @jflatnes

Some servers have the “imagick” PHP extension installed; if this is the case, you can use the Imagick strategy and get all the features of ImageMagick without needing to mess with the command line.

Hi @jflatnes

dumb question but what that be something like

<policy domain="execute" rights="read | write" pattern="mpeg:decode" />

Our it department has created a custom delegate file, but that doesnt seem to have changed anything

# ImageMagick delegates for Unix.  The format is as follows.  Each
# delegate begins with a tag and/or format separated by a operator tag
# (<=, <=>, =>).  This line must be followed by one or more commands
# preceded with a tab (\t) character.  If a command exceeds the length of
# a line, use the backslash continuation character.  End the command with
# an ampersand (&) to execute the command in the background.
# 
# Optionally you can include the image filename, type, width, height, or
# other image attributes by embedding special format characters:
# 
#   %b   file size
#   %d   directory
#   %e   filename extention
#   %f   filename
#   %h   height
#   %i   input filename
#   %l   label
#   %m   magick
#   %n   number of scenes
#   %o   output filename
#   %p   page number
#   %q   quantum depth
#   %s   scene number
#   %t   top of filename
#   %u   unique temporary filename
#   %w   width
#   %x   x resolution
#   %y   y resolution
#   %z   data written to this file is discarded
# 
# There are three types of delegates: decode, encode, and bypass.  Decode
# delegates begin with a image format (tag) specified (e.g. mpeg) followed
# with a equal-greater sign (=>).  The delegate is invoked whenever ImageMagick
# attempts to read an image whose format specifier or filename extension
# matches the tag (e.g.  image.mpg for tag mpg=>).  The delegate must
# write an image to the file designated by %o in an image format that
# ImageMagick understands (e.g. pnm).
# 
# An encode delegate begins with an image format, a less-equal sign (<=),
# and a tag.  The delegate is invoked whenever ImageMagick attempts to
# write an image whose format specifier or filename extension matches the
# tag (e.g. image.mpg for tag <=mpg).  ImageMagick writes to a temporary
# file in the format you specify.  The delegate can then read this file
# and convert it to a format it supports and presumably ImageMagick does
# not.
# 
# If you use a less-equal-greater sign (<=>) the delegate bypasses
# ImageMagick and directly converts the image file if it is untainted
# (no image manipulations such as resize or rotation).
# 
# Lines that begin with a pound sign (#) are comments and are ignored.
# 
# There are a number of delegates used by ImageMagick for special
# circumstances.  For example, the print or Ghostscript delegate.  Don't
# remove these or ImageMagick may behave strangely.
# 
# ImageMagick looks for the delegate configurarion file in this order:
# 
#     /usr/local/share/ImageMagick/delegates.mgk
#     DELEGATE_PATH/delegates.mgk
#     HOME/.magick/delegates.mgk
#     ./delegates.mgk
# 
# where DELEGATE_PATH and HOME are environment variables.
# 
# Like entries in the later two directory overrides the specification in
# the system-wide delegates file.
#
#
<=bzip
	|bzip2 -f > %o
<=compress
	|compress -c > %o
<=show
	display -immutable -window_group %g -title "%l of %f" tmp:%o &
<=zip
	|gzip -cf > %o
browse=>
	netscape http://www.wizards.dupont.com/cristy/ImageMagick.html &
bzip=>
	|bzip2 -cd %i
cgm=>
	ralcgm -d ps %i %o %u
	convert -concatenate %o*.ps %o
compress=>
	|uncompress -c %i
dot=>
	dot -Tps %i -o %o 
dvi=>
	dvips -q -o %o %i
edit=>
	xterm -title "Edit Image Comment" -e vi %o
emf=>
	wmftogif %i %o
eps<=>pdf
	gs -dMaxBitmap=300000000 -sDEVICE=pdfwrite -q -dNOPAUSE -dSAFER \
	  -sOutputFile="%o" -- "%i" -c quit
eps<=>ps
	gs -dMaxBitmap=300000000 -sDEVICE=pswrite -q -dNOPAUSE -dSAFER \
	  -sOutputFile="%o" -- "%i" -c quit
file=>
	GET %m:%i > %o 2>&1
fig=>
	fig2dev -L ps %i %o
ftp=>
	GET %m:%i > %o 2>&1
# Gnuplot format (rendered as Postscript)
# Add additional gnuplot commands to the input file to adjust output.
gplt=>
	echo "set size 1.25,0.62; set terminal postscript portrait color solid; set output '%o'; load '%i'" > %u
	gnuplot %u
gs-color=>
	gs -dMaxBitmap=300000000 -sDEVICE=pnmraw -q -dNOPAUSE -dSAFER \
	  -dTextAlphaBits=%u -dGraphicsAlphaBits=%u -g%s -r%s %s \
	  -sOutputFile="%s" -- "%s" -c quit
gs-mono=>
	gs -dMaxBitmap=300000000 -sDEVICE=pbmraw -q -dNOPAUSE -dSAFER \
	  -dTextAlphaBits=%u -dGraphicsAlphaBits=%u -g%s -r%s %s \
	  -sOutputFile="%s" -- "%s" -c quit
hpgl=>
	hp2xx -q -m eps -f `basename %o` %i
	mv `basename %o` %o
htm=>
	html2ps -U -o %o %i
html=>
	html2ps -U -o %o %i
http=>
	GET %m:%i > %o 2>&1
ilbm=>
	ilbmtoppm %i > %o 
man=>
	groff -man -Tps %i > %o
mpg=>
	mpeg2decode -q -b %i -f -r -o3 %o%%05d
	convert -concatenate %o*.ppm %o
m2v=>
	mpeg2decode -q -b %i -f -r -o3 %o%%05d
	convert -concatenate %o*.ppm %o
pdf<=>eps
	gs -dMaxBitmap=300000000 -sDEVICE=epswrite -q -dNOPAUSE -dSAFER \
	  -sOutputFile="%o" -- "%i" -c quit
pdf<=>ps
	gs -dMaxBitmap=300000000 -sDEVICE=pswrite -q -dNOPAUSE -dSAFER \
	  -sOutputFile="%o" -- "%i" -c quit
pgp=>
	pgpv -fq %i
pnm<=ilbm
	ppmtoilbm -24if %i > %o
pnm<=launch
	gimp %i
pnm<=win
	display -immutable %i
pov=>
	povray +i%i +o%o +fn%q +w%w +h%h +a -q9 -kfi%s -kff%n
	convert -concatenate %o*.png %o
ps<=>eps
	gs -dMaxBitmap=300000000 -sDEVICE=epswrite -q -dNOPAUSE -dSAFER \
	  -sOutputFile="%o" -- "%i" -c quit
ps<=>pdf
	gs -dMaxBitmap=300000000 -sDEVICE=pdfwrite -q -dNOPAUSE -dSAFER \
	  -sOutputFile="%o" -- "%i" -c quit
ps<=print
	lp -c -s %i
rad=>
	ra_ppm -g 1.0 %i %o
rgba<=rle
	mogrify -flip -size %wx%h rgba:%i
	rawtorle -w %w -h %h -n 4 -o %o %i
scan=>
	scanimage -d %i > %o
shtml=>
	html2ps -U -o %o %i
txt<=>ps
	enscript -o %o %i
wmf=>
	wmftogif %i %o
xcf=>
	xcftopnm %i > %o 
yuv<=m2v
	mpeg2encode %u %o
	convert -concatenate %i*.yuv %u
yuv<=mpg
	mpeg2encode %u %o
	convert -concatenate %i*.yuv %u
zip=>
	|gzip -cdfq %i

No, I believe the “domain” should stay as “delegate” but it’s “rights” that should be “execute” in this case.

Thanks @jflatnes

I think we have tried to apply your notes.

<policymap>

  <!-- <policy domain="resource" name="temporary-path" value="/tmp"/> -->

  <policy domain="resource" name="memory" value="256MiB"/>

  <policy domain="resource" name="map" value="512MiB"/>

  <policy domain="resource" name="width" value="16KP"/>

  <policy domain="resource" name="height" value="16KP"/>

  <policy domain="resource" name="area" value="128MB"/>

  <policy domain="resource" name="disk" value="1GiB"/>

  <!-- <policy domain="resource" name="file" value="768"/> -->

  <!-- <policy domain="resource" name="thread" value="4"/> -->

  <!-- <policy domain="resource" name="throttle" value="0"/> -->

  <!-- <policy domain="resource" name="time" value="3600"/> -->

  <!-- <policy domain="system" name="precision" value="6"/> -->

  <!-- not needed due to the need to use explicitly by mvg: -->

  <!-- <policy domain="delegate" rights="none" pattern="MVG" /> -->

  <!-- use curl -->

  <policy domain="delegate" rights="execute" pattern="mpeg:decode" />

  <policy domain="delegate" rights="none" pattern="URL" />

  <policy domain="delegate" rights="none" pattern="HTTPS" />

  <policy domain="delegate" rights="none" pattern="HTTP" />

  <!-- in order to avoid to get image with password text -->

  <policy domain="path" rights="none" pattern="@*"/>

  <policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/>

  <!-- disable ghostscript format types -->

  <policy domain="coder" rights="read | write" pattern="PS" />

  <policy domain="coder" rights="read | write" pattern="PS2" />

  <policy domain="coder" rights="read | write" pattern="PS3" />

  <policy domain="coder" rights="read | write" pattern="EPS" />

  <policy domain="coder" rights="read | write" pattern="PDF" />

  <policy domain="coder" rights="read | write" pattern="XPS" />

  <policy domain="coder" rights="read|write" pattern="{GIF,JPEG,PNG,WEBP}" />
 <policy domain="coder" rights="execute" pattern="MP4" />
<policy domain ="coder" rights="execute" pattern="mpeg:decode"/>
</policymap>

and it seems like we got it working on the terminal command line

 root@devubuomk001:~# convert -verbose "library.mp4[0]" test.jpg

'ffmpeg' -nostdin -v -1 -i '/tmp/magick-2694tctzyBgSu2E6' -vframes 1 -vcodec pam -an -f rawvideo -y '/tmp/magick-2694kx-Puaig1seE.pam' 2> '/tmp/magick-2694kx-Puaig1seE'
/tmp/magick-2694kx-Puaig1seE.pam PAM 1920x1080 1920x1080+0+0 8-bit TrueColor sRGB 6.221MB 0.020u 0:00.020
library.mp4[0]=>/tmp/magick-2694kx-Puaig1seE.pam PAM 1920x1080 1920x1080+0+0 8-bit TrueColor sRGB 6.221MB 0.000u 0:00.000
library.mp4[0]=>test.jpg PAM 1920x1080 1920x1080+0+0 8-bit TrueColor sRGB 335KB 0.040u 0:00.039

as we got an image output that looks good.
However omeka still throws an error:

Command "/usr/bin/convert '/tmp/omeka2zu9vP[0]' -auto-orient -background white +repage -alpha remove -thumbnail '800x800>' '/tmp/omekayfJRQG.jpg'" failed with status code 1.

Any more ideas and thanks for sticking with us.

Yeah, that looks OK on the command line.

What version of Omeka S are you using? We made an improvement in 2.1.2 I believe to how videos in particular get handled that should avoid the problem I think is happening here.