I'm using the image library to store an image on the server, all works well until I send an image of this dimension: 5184 x 3456
This is the function that I've created to store the image:
PHP Code:
protected function storeImage(string $path, string $fileName, string $width, string $height)
{
$imgServ = \Config\Services::image();
$ext = pathinfo($fileName, PATHINFO_EXTENSION);
$uploadPath = $path . basename($fileName, ".{$ext}") . "_{$width}x{$height}." . $ext;
$imgServ
->withFile(ROOTPATH . 'public/' . $path . $fileName)
->fit(1024, 1024, 'center')
->save(ROOTPATH . 'public/' . $uploadPath);
return $uploadPath;
}
than I got:
<br />
<b>Fatal error</b>: Allowed memory size of 134217728 bytes exhausted (tried to allocate 16384 bytes) in <b>/var/www/html/vendor/codeigniter4/framework/system/Images/Handlers/GDHandler.php</b> on line <b>220</b><br />
<br />
<b>Fatal error</b>: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in <b>/var/www/html/vendor/codeigniter4/framework/system/Log/Handlers/FileHandler.php</b> on line <b>1</b><br />
how can I fix this?