J'utilise Glide sur Laravel et j'ai un "petit" problème avec ça. Quand je charge une petite image par outputImage()
tout va bien. Mais lorsque je tente de charger - pour simple - 1.6MB de l'image Laravel mis dans la console:Laravel glisse de la mémoire
Allowed memory size of 67108864 bytes exhausted (tried to allocate 14152 bytes) in C:\Users\displate\Documents\displate\vendor\intervention\image\src\Intervention\Image\Gd\Decoder.php on line 34
Comment puis-je simplement résoudre ce problème?
Bad partie de mon code:
protected function get($path,$storage,$sizes,$prefix=''){
ini_set('memory_limit', '64M'); // it's not working :<
if($this->check_variables($sizes)){
$server=$this->prepare_server($storage,$prefix);
try{
$server->getImageResponse($path);
$server->outputImage($path, $_GET);
}
catch(\Exception $e){
$this->download_image($path,$storage);
$server->getImageResponse($path);
$server->outputImage($path, $_GET);
}
}
else{
abort(404);
}
}
protected function prepare_server($storage_name,$prefix=''){
$server = \League\Glide\ServerFactory::create([
'source' => \Storage::disk($storage_name)->getDriver(),
'cache' => \Storage::disk($storage_name)->getDriver(),
'source_path_prefix' => $prefix,
'cache_path_prefix' => $storage_name.'_cached',
]);
$_GET['fit']='crop';
$_GET['crop']='center';
return $server;
}
La limite de mémoire aide-moi, j'utilise maintenant 512Mb – ventaquil