Laravel 5.2 Intervention Image 500服务器错误 [英] Laravel 5.2 Intervention Image 500 Server Error

查看:66
本文介绍了Laravel 5.2 Intervention Image 500服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我上传大图像时(4.2 MB)干预图像抛出500错误...

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);
}

它适用于较小的文件. upload_max_filesize=10M.当我评论此功能时,它起作用:/

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

推荐答案

我遇到了同样的问题,仅增加upload_max_filesize是不够的. 我还增加了memory_limit to 256M并重新启动了服务器.然后,图像在Intervention中起作用. [以上更改均在php.ini文件中]

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]

您可能要根据使用的文件容量更改upload_max_filesizememory_limit.

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

这篇关于Laravel 5.2 Intervention Image 500服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆