大图像上的Codeigniter图像大小调整和裁剪错误

时间:2015-06-13 03:12:41

标签: php image codeigniter gd2

我只是使用8GB内存的基本PHP服务器,它只运行LAMP服务器。

我有一个codeigniter V3正在运行,我可以上传小图像并轻松调整它们的大小。

但如果我上传大于540 x 540的图像,则会出现以下错误

遇到PHP错误

严重性:警告

Message: imagecreatetruecolor(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully

Filename: libraries/Image_lib.php

Line Number: 807

Backtrace:

File: /home/boomboomdead/public_html/application/controllers/File.php
Line: 127
Function: crop

File: /home/boomboomdead/public_html/application/controllers/File.php
Line: 173
Function: generate_thumbs

File: /home/boomboomdead/public_html/index.php
Line: 292
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: imagealphablending() expects parameter 1 to be resource, boolean given

Filename: libraries/Image_lib.php

Line Number: 811

Backtrace:

File: /home/boomboomdead/public_html/application/controllers/File.php
Line: 127
Function: crop

File: /home/boomboomdead/public_html/application/controllers/File.php
Line: 173
Function: generate_thumbs

File: /home/boomboomdead/public_html/index.php
Line: 292
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: imagesavealpha() expects parameter 1 to be resource, boolean given

Filename: libraries/Image_lib.php

Line Number: 812

Backtrace:

File: /home/boomboomdead/public_html/application/controllers/File.php
Line: 127
Function: crop

File: /home/boomboomdead/public_html/application/controllers/File.php
Line: 173
Function: generate_thumbs

File: /home/boomboomdead/public_html/index.php
Line: 292
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: imagecopyresampled() expects parameter 1 to be resource, boolean given

Filename: libraries/Image_lib.php

Line Number: 815

Backtrace:

File: /home/boomboomdead/public_html/application/controllers/File.php
Line: 127
Function: crop

File: /home/boomboomdead/public_html/application/controllers/File.php
Line: 173
Function: generate_thumbs

File: /home/boomboomdead/public_html/index.php
Line: 292
Function: require_once

我不知道该怎么做,因为在我的本地电脑上一切都很好。我的意思是我上传了3000张X 2000照片和作物。

我在mac book pro上,有8GB内存,但在远程服务器上,一切都出错了

1 个答案:

答案 0 :(得分:-1)

我通过减少文件名中字符的数量修复了类似的问题。