Search code examples
laravellaravel-5intervention

Laravel 5.2 Intervention Image 500 Server Error


When I upload big images (4.2 MB) Intervention Image is throwing 500 Error...

private function resizeImage($path, $imgName){
    $sizes = getimagesize($path.$imgName);
    if($sizes[0] > $sizes[1]){
        ImageManagerStatic::make($path.$imgName)->fit(920,474)->insert(public_path() . "/uploads/applications/watermark.png",'bottom-right', 30, 30)->save($path."1_".$imgName);
    }else{
        ImageManagerStatic::make($path.$imgName)->heighten(474)->insert(public_path() . "/uploads/applications/watermark.png",'bottom-right', 30, 30)->save($path."1_".$imgName);
    }
    ImageManagerStatic::make($path.$imgName)->fit(440,226)->save($path."2_".$imgName);
    File::delete($path.$imgName);
}

It works for smaller files. upload_max_filesize=10M. When I comment this function it works :/


Solution

  • I had the same issue and increasing upload_max_filesize were not enough. I also increased memory_limit to 256M and restarted the server. Then images were working with Intervention. [Above changes are in php.ini file]

    You may want to change upload_max_filesize and memory_limit according to file capacity you are using.