Problems with creating thumbs (GD and Imagick)


i am trying to creating thumbs. GD and IM is available on the server.

When useing IM with the following config:

    'thumbs' => [
        'quality' => 100,
        'driver' => 'im',
        'format' => 'webp',
        'presets' => [
            'default' => ['width' => 1280],
            'large' => ['width' => 1920],
            'blog' => ['width' => 960],
            'event' => ['width' => 960]

i get this error and no images are created:

status "error" exception "Exception" code 0 message "The imagemagick convert command could not be executed: 'convert' -limit thread 1 '/var/www/vhosts/' -auto-orient -thumbnail '1280x1462!' -quality '100' '/var/www/vhosts/'" details null file "/kirby/src/Image/Darkroom/ImageMagick.php" line 146

With GD i am using the same config without the 'driver' => 'im' ofcourse and images are created but very pixelated (scaled from 6000px to 1280px):

Am i missing something out?

Do you get anything in the php error logs as well.

I guess either webp is not supported by your version of ImageMagick (check the version) or your server prohibits executing the exec() command.

Regarding GD, what is the input image type? Images seems rather large with 6000px?

Thank you very much for your super quick answer!

According to infophp() webp is supported:

The errorlog shows some more details which might lead into your guess, that process() is forbidden, what do you think? :

Exception: The imagemagick convert command could not be executed: 'convert' -limit thread 1 '/var/www/vhosts/' -auto-orient -thumbnail '1280x1462!' -quality '100' '/var/www/vhosts/' in /var/www/vhosts/\nStack trace:\n#0 /var/www/vhosts/ Kirby\\Image\\Darkroom\\ImageMagick->process()\n#1 /var/www/vhosts/ Kirby\\Cms\\Core->{closure}()\n#2 /var/www/vhosts/ Kirby\\Cms\\App->thumb()\n#3 /var/www/vhosts/ Kirby\\Cms\\Media::thumb()\n#4 /var/www/vhos...'

I used a very large image because i wanted to test if i could use the thumbs as a validation if people are using images on their website which they downloaded from stockpages. Cause they are normally relatively large. Or may this be a little to heavy to handle?

Try something simple, assuming your are on a Unixy system, put this line into a template and open the page in your browser. This should create a new empty file hello.txt in the root of your project if exec works.

<?php exec('touch ' . kirby()->root() . '/hello.txt' ); ?>

Also, on the command line on your server, type:

convert --version

This I don’t understand…

Good Morning,

thanks for your help. ‘Convert’ was not available. We reinstalled Imagick from the server and everything is fine now.

What i meant was that i wanted to use thumbs in my template to prevent users from ramping up loading time of the page when throwing in large images from Stockpages etc.

Keep in mind that ImageMagick (the software) and imagick (a PHP extension ) are not to be confused. Kirby used ImageMagick via exec(), not the PHP imagick extension.

Ah okay. According to my info.php they kind of work together (?) Because they are listed together i thought they would be the same. Im am really lacking backgroundinformation about that.

That’s right, the PHP imagick extension uses ImageMagick.
But Kirby doesn’t use the PHP extension but ImageMagick directly via exec(). Because the imagick PHP extension is not widely available.