Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot create thumbnail in ImageMagick: "convert: no decode delegate for this image format"
    text
    copied!<p>I've been at this all day. I'm trying to upload images to a Mediawiki and this is the error I get when ImageMagick tries to create the thumbnail:</p> <pre><code>Error creating thumbnail: convert: no decode delegate for this image format `/tmp/magick-11924QG1rRXzT948I' @ error/constitute.c/ReadImage/552. convert: no images defined `/tmp/s3thumb-cripEh' @ error/convert.c/ConvertImageCommand/3127. </code></pre> <p>I setup a debug file for mediawiki and this is what I get in the log:</p> <pre><code>BitmapHandler::doTransform: creating 112x120 thumbnail at /tmp/s3thumb-cripEh using scaler im BitmapHandler::doTransform: called wfMkdirParents(/tmp) BitmapHandler::getMagickVersion: Running convert -version wfShellExec: /bin/bash '/var/www/mediawiki-1.21.2/includes/limit.sh' ''\''/usr/local/bin/convert'\'' -version' 'MW_CPU_LIMIT=180; MW_CGROUP='\'''\''; MW_MEM_LIMIT=202400; MW_FILE_SIZE_LIMIT=102400; MW_WALL_CLOCK_LIMIT=180' BitmapHandler::transformImageMagick: running ImageMagick: '/usr/local/bin/convert' -quality 80 -background white -define jpeg:size=112x120 '' -thumbnail '112x120!' -depth 8 -sharpen '0x0.4' -rotate -0 '/tmp/s3thumb-cripEh' 2&gt;&amp;1 wfShellExec: /bin/bash '/var/www/mediawiki-1.21.2/includes/limit.sh' 'OMP_NUM_THREADS='\''1'\'' '\''/usr/local/bin/convert'\'' -quality 80 -background white -define jpeg:size=112x120 '\'''\'' -thumbnail '\''112x120!'\'' -depth 8 -sharpen '\''0x0.4'\'' -rotate -0 '\''/tmp/s3thumb-cripEh'\'' 2&gt;&amp;1' 'MW_CPU_LIMIT=180; MW_CGROUP='\'''\''; MW_MEM_LIMIT=202400; MW_FILE_SIZE_LIMIT=102400; MW_WALL_CLOCK_LIMIT=180' [thumbnail] thumbnail failed on ip-10-168-26-167: error 1 "convert: no decode delegate for this image format `/tmp/magick-11924QG1rRXzT948I' @ error/constitute.c/ReadImage/552. convert: no images defined `/tmp/s3thumb-cripEh' @ error/convert.c/ConvertImageCommand/3127." from "'/usr/local/bin/convert' -quality 80 -background white -define jpeg:size=112x120 '' -thumbnail '112x120!' -depth 8 -sharpen '0x0.4' -rotate -0 '/tmp/s3thumb-cripEh' 2&gt;&amp;1" LocalS3File::transform thumb: LocalS3File::transform thumbTempPath: /tmp/s3thumb-cripEh, dest: wiki-images/thumb/1/19/5ovrDaU.jpg/112px-5ovrDaU.jpg info:1 LocalS3File::transform return thumb: MediaTransformError Object ( [htmlMsg] =&gt; Error creating thumbnail: convert: no decode delegate for this image format `/tmp/magick-11924QG1rRXzT948I' @ error/constitute.c/ReadImage/552.&lt;br /&gt; convert: no images defined `/tmp/s3thumb-cripEh' @ error/convert.c/ConvertImageCommand/3127.&lt;br /&gt; [textMsg] =&gt; Error creating thumbnail: convert: no decode delegate for this image format `/tmp/magick-11924QG1rRXzT948I' @ error/constitute.c/ReadImage/552.&lt;br /&gt; convert: no images defined `/tmp/s3thumb-cripEh' @ error/convert.c/ConvertImageCommand/3127.&lt;br /&gt; [width] =&gt; 112 [height] =&gt; 120 [url] =&gt; [path] =&gt; [file] =&gt; [page] =&gt; [responsiveUrls] =&gt; Array ( ) [storagePath:protected] =&gt; ) </code></pre> <p>Tried from the command line, copy pasted the command from the log (but used a test file):</p> <p><code>convert -quality 80 -background white -define jpeg:size=112x120 '' -thumbnail '112x120!' -depth 8 -sharpen '0x0.4' -rotate -0 'logo.jpg</code>'</p> <p>but the process hangs. If I run: </p> <pre><code>sudo convert logo.png -quality 80 -background white -define jpeg:size=112x120 -thumbnail '112x120!' -depth 8 -sharpen '0x0.4' -rotate -0 logo.jpg </code></pre> <p>It works. </p> <p>If I check DELEGATES, I have:</p> <pre><code>DELEGATES jng jp2 jpeg png ps tiff xml zlib </code></pre> <p>I tried increasing the default memory on media wiki to</p> <pre><code>$wgMaxShellMemory = 202400; </code></pre> <p>I feel like I've tried anything. Any ideas?</p> <p><strong>EDIT:</strong> This is what I've discovered so far: </p> <p>I'm pretty sure the shell wasn't executing the ImageMagick command because of the escaped backslashes in :</p> <pre><code>wfShellExec: /bin/bash '/var/www/mediawiki-1.21.2/includes/limit.sh' ''\''/usr/local/bin/convert'\'' -version' 'MW_CPU_LIMIT=180; MW_CGROUP='\'''\''; MW_MEM_LIMIT=202400; MW_FILE_SIZE_LIMIT=102400; MW_WALL_CLOCK_LIMIT=180' </code></pre> <p>Those <code>''\''</code> are causing the command to not run, and hence the <code>"no decode"</code> error. It can't decode, because the file is not there. I've traced <code>wfShellEec</code> to <code>GlobalFunctions.php</code>. The wfShellExec function is at around line 2778 on my file.</p> <p>In the <code>if ( php_uname( 's' ) == 'Linux' )</code> block there is:</p> <pre><code>escapeshellarg( $cmd ) </code></pre> <p>I removed the <code>escapeshellarg()</code> function and just left the <code>$cmd</code> on its own.</p> <p>Tried uploading again, the error is gone, the files are created, but now the thumbnail files are 0 bytes.</p> <p>Any ideas?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload