Error on big Image Resize in PHP

On local server I modify the htaccess to

## Wappler routing
RewriteEngine On
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?(?:/)?$ index.php [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?admin/project_list(?:/)?$ admin/project_list.php [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?admin/project_detail/([^/]+?)(?:/)?$ admin/project_detail.php?URL_project=$1 [QSA,NC,L]
## End Wappler routing
## Start Max File Upload Size
php_value upload_max_filesize 10M
php_value post_max_size 11M

But I test with phpinfo and still get the 2mb for upload_max_filesize

Any help??

It won’t change the size in the php.ini file itself it will just override it. If you have access to the actual file you can change it there but most hosts don’t allow access. What are you using for a local server? You may have to test on live server. Be sure to clear your browser memory as well

1 Like

I tested remotely and not change. Add to the htacccess file:

## Start Max File Upload Size
php_value upload_max_filesize 10M
php_value post_max_size 11M

On my server panel I find the php settings

So I dont think this is the problem.

Here is the php settings. So this is not the problem.

Why do you have two values for that?
2mb and 100mb?
The upload_max_filesize on the php.ini is the one you need to change..

Have you changed it?

I have done before from the server itself (Prior this project). Default is 2 mb

Sorry, I don't understand, before was 2MB and now 100MB?

If you changed it you'll need to restart apache

No It was already changed for other project . Anyway I restart the service but still the same problem.

Yikes, 100MB is high!

Set Max Post to 11MB and MaxFileSize to 10MB. Post should be slightly higher than max file size.

I make a new test. I compress the image quality with photoshop and respect the image size in px (Only less quality). The file weight is 2 mb but the picture is 7000 × 5317px

So I conclude that the file size in MB is not related to the error. I think the resizer CANT handdle big images.

Test the same with a more compressed image and still have the same issue only (690kb)

Further investigation on console get this error.

[Thu May 23 17:07:34 2024] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 28672 bytes) in /Volumes/Bycom/Websites/DreamhomesWappler/www/dmxConnectLib/lib/image/Processor.php on line 29
[Thu May 23 17:07:34 2024] [::1]:60659 [200]: POST /dmxConnect/api/admin/projectModules.php - Allowed memory size of 134217728 bytes exhausted (tried to allocate 28672 bytes) in /Volumes/Bycom/Websites/DreamhomesWappler/www/dmxConnectLib/lib/image/Processor.php on line 29

Can you update memory_limit to 256mb?

Your error is with one specific image?
Have you tried with other images?
I remember I had problem with a broken image that had similar strange behavior...

You need to increase the memory limit in your server config / php.ini
Try setting it to 256MB