Codeigniter Image Resize and Crop Error on big images

496 views Asked by At

Im just using a basic PHP server with 8GB ram, Its just running a LAMP server.

I have a codeigniter V3 running and I could upload small images and crop resize them on the fly easy.

But if I upload images bigger than 540 x 540 then I get the following error

A PHP Error was encountered

Severity: Warning

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

I do not know what to do, because on my local computer everything works sweet. I mean I uploded 3000 X 2000 photo and crops great.

Im on a mac book pro, 8GB memory is there but on the remote server, everything is going wrong

1

There are 1 answers

1
Webspider On

I fixed a similar issue by reducing the amout of characters in the filename.