首页 > 其他 > 详细

TP5图片处理常见问题

时间:2020-07-29 14:23:16      阅读:321      评论:0      收藏:0      [点我收藏+]

一、Class ‘think\Image‘ not found

composer require topthink/think-image 装上了扩展
控制器头部加了 use think\Image
然后\think\image::open($imgSrc);提示Class ‘think\Image‘ not found

最简单的解决方法是把 ./vendor/topthink/think-image/src下的文件(包括image.php和image文件夹)
移动到 ./thinkphp/library/think 目录下,
再回到原来的程序中,就不会报错了
技术分享图片
 
 
 

二、Image::open 处理图片失败

处理6MB以上的图片时会发生内存溢出? "Allowed memory size of 268435456 bytes exhausted (tried to allocate 84105217 bytes)...topthink/think-image/src/Image.php:267"

 

因为处理高清图造成的内存崩溃所以无法返回处理结果。

处理方法:修改 memory_limit 为256M后,复试,成功。

TP5图片处理常见问题

原文:https://www.cnblogs.com/chengwens/p/13396241.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!