Image->resize() not working

I just migrated a dev page to a live page and apparently the image->resize() function does not work anymore. PHP is set to 7.4.10 – my guess is that the hosting company hasn’t enabled the PHP proper module though. (Server API says FPM/FastCGI)

Phpinfo() is not showing any results when searching the page for “GD” (only the authors section) or when searching for “Imagick”.

Is Kirby using GD or Imagick so that I can ask the company for activating the proper module?

Thx!

The requirement is for the gd library to be present, see the documentation: https://getkirby.com/docs/guide/quickstart#requirements

Imagagick is an alternative that you can use instead of gd, if it is supported by the server. You would have to set the thumbs driver to im in config in that case.

1 Like

Ok, thanks! Silly question, but is it actually standard to have the GD library be present or would it be an unusual request to the hosting company?

That is actually standard or should be. All CMSs depend on an image modification library.

1 Like

OK thanks again!

I’m using MAMP Pro on the Mac with PHP 8, but image->resize() didn’t work (no error, but images keeps original size). My quick solution was simply to set MAMP Pro back to PHP 7.4. After that image->resize() worked instantly again, without any further configuration of PHP.

Probably worth looking into why it’s not working. Check phpinfo() if gd/imagemagick is enabled and what is set in your config. (With my MAMP Pro version 6.3.1 and PHP 8 it works)

You right - i will invest some time to this topic later :wink: Just a quick note, that I use a fresh install from MAMP Pro 6.3.1. So in my case it did not work out of the box.

I have the same problem. MAMP 6.3 and PHP 8 but researching the web gives tells me that MAMP on OS X misses Gd on php 8 and I have no idea how to add it.

Images get the correct filename like filename-400-400-60.jpg but they are not cropped or resized…

Anyway when switching back to php 7.4.12 It works.
I wonder though if anyone got php8 and MAMP with GD running.

Cheers

2 Likes

odd thing… I had the same issue: Mac + latest MAMP Pro, tried all PHP versions (7.x, 8.x) and no resizing or cropping. I rebooted and it worked on all PHP versions. Not the most elegant thing to try, but still, I’d recommend trying a reboot :smiley:

1 Like

I had a similar problem that my favicon.png was not scaled. Other images were scaled with resize(). I resaved and replaced the favicon.png and suddenly resize() worked. Possibly it was due to an embedded color profile or meta tags in the .png

<?php if($favicon = $site->favicon()->toFile()): ?>
<link rel="apple-touch-icon" sizes="180x180" href="<?= $favicon->resize(180)->url() ?>" />
<link rel="icon" type="image/png" href="<?= $favicon->resize(196)->url() ?>" sizes="196x196" />
<link rel="icon" type="image/png" href="<?= $favicon->resize(96)->url() ?>" sizes="96x96" />
<link rel="icon" type="image/png" href="<?= $favicon->resize(32)->url() ?>" sizes="32x32" />
<link rel="icon" type="image/png" href="<?= $favicon->resize(16)->url() ?>" sizes="16x16" />
<meta name="msapplication-TileImage" content="<?= $favicon->resize(150)->url() ?>" />
<?php endif ?>