i'm using glide on laravel , have "small" problem it. when load small image outputimage() okay. when try load - simple - 1.6mb of image laravel put in console:
allowed memory size of 67108864 bytes exhausted (tried allocate 14152 bytes) in c:\users\displate\documents\displate\vendor\intervention\image\src\intervention\image\gd\decoder.php on line 34 how can simple fix it?
bad part of 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; }
if youre sure running out of memory reasons think, , not infinite loop or other error, can increase amount of memory php able use doing following.
- locate php.ini file used web server
- edit memory_limit parameter in php.ini file (usually in section called resource limits)
- restart apache.
it should afterwards:
memory_limit 128m if stuck, this looks resource
64mb, have, isnt much. id stick @ 512m or 1024m if have ram.
Comments
Post a Comment