一、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 目錄下,
再回到原來的程序中,就不會報錯了
移動到 ./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后,復試,成功。