Problems with creating thumbs (GD and Imagick)

Hey,

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/khepri.design/httpdocs/demo.khepri.design/media/pages/home/d93c329dc9-1697738554/yoga-group-1280x.webp' -auto-orient -thumbnail '1280x1462!' -quality '100' '/var/www/vhosts/khepri.design/httpdocs/demo.khepri.design/media/pages/home/d93c329dc9-1697738554/yoga-group-1280x.webp'" 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): https://demo.khepri.design/media/pages/home/1cfbc81c4b-1699381900/girls-yoga-group-1280x.webp

Am i missing something out?
Greetings

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/khepri.design/httpdocs/demo.khepri.design/media/pages/home/d93c329dc9-1697738554/yoga-group-1280x.webp' -auto-orient -thumbnail '1280x1462!' -quality '100' '/var/www/vhosts/khepri.design/httpdocs/demo.khepri.design/media/pages/home/d93c329dc9-1697738554/yoga-group-1280x.webp' in /var/www/vhosts/khepri.design/httpdocs/demo.khepri.design/kirby/src/Image/Darkroom/ImageMagick.php:146\nStack trace:\n#0 /var/www/vhosts/khepri.design/httpdocs/demo.khepri.design/kirby/config/components.php(343): Kirby\\Image\\Darkroom\\ImageMagick->process()\n#1 /var/www/vhosts/khepri.design/httpdocs/demo.khepri.design/kirby/src/Cms/App.php(1595): Kirby\\Cms\\Core->{closure}()\n#2 /var/www/vhosts/khepri.design/httpdocs/demo.khepri.design/kirby/src/Cms/Media.php(131): Kirby\\Cms\\App->thumb()\n#3 /var/www/vhosts/khepri.design/httpdocs/demo.khepri.design/kirby/src/Cms/Media.php(60): 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.