I’m doing a little project for a charity and they’re using pretty large high res images, like really large, some are as large as 11 MB. The error below is from an image which is 8MB large.
Now, I’ve been using the focus plugin to handle these images, but if their size is going to lead to issues for the site is is recommended I maybe implement an actual cropper to reduce file sizes?
I’ve also noticed that speed’s been effected quite badly by loading images anyway, so I need to do something on that front. If someone has dealt with this before please let me know what the best course of action is thank you!
Both removing and reducing the file size (by a manual crop) doesn’t error. This has happened a few times.
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 22464 bytes) in
C:\xampp\htdocs\Projects\1-Kirby\Project-Ladder\Ladder-V0.15\kirby\toolkit\vendors\abeautifulsite\SimpleImage.php on line 300
It’s looking like that’s the best course of action right now.
In order to get the site live I’ll crop the large images down, but if this is going to cause an error every time then I need a better solution because I don’t know who’s going to upload an image a year from now.
I can’t rely on people doing the right thing. Maybe I could add some rules/checks in. Image files 3-4 MB and smaller, or resolution restrictions? With maybe a suggestion of cropping the image and then trying to upload again.
They’re hero/banner images and it’s only appearing on a couple of pages. Like every page has one and each image is of equal size when cropped and the upload sizes vary between 5 MB and 11 MB
You could try to switch to imagemagick. You are probably still using GD Lib, which is the default library to handle image resizing. Imagemagick is better at handling large images.
You can switch to imagemagick, if it’s installed on your server like this:
// in site/config/config.php
c::set('thumbs.driver', 'im');
The limit set in my php,ini file is 128MB for my local version I don’t know what’s on my test server though. Must be the same because the error is occurring on both my local and my live test server.
So I tried it and it’s no longer producing an error but it’s no longer cropping the image with the focus plugin (see below).
Maybe Imagemagick isn’t installed locally? I know it’s installed by my host but I haven’t installed it locally I’m just using what was installed with XAMP.
@Thiousi Kirby is using imagemagick from the command-line, rather than PHP’s Imagick-extensions. so imagemagicks binary convert has to installed on the server.