XF 2.2 Uploaded file is too large

GAD

Member
Confirmed that php.ini (7.4.3) contains:

post_max_size = 80M
upload_max_filesize = 50M

Confirmed that the php.ini file is being used by Apache2 via phpinfo().

Confirmed that src/config.php contains:

$config['maxImageResizePixelCount'] = 60000000;

Meanwhile my test file, which is a 1.8MB PNG file that's 1600x900 throws the error, as do many many other images. A 517KB 800x450 PNG image works fine.

This was working until a couple of days ago when I rebooted. Site error_log show nothing, and there's nothing in any of the logs in the admin console. If there's somewhere else to look I'm all for it, but I'm at a loss.
 
Check the Default image processor setting. What setting is selected now?

Setup - Options - Attachments - Default image processor

PHP built-in GD image library

I had installed the Resize Attachments All Add-On but disabled it when I discovered that it required PECL.
 
Andy (Thanks!) and I stepped through all the normal stuff, but I figured the final result might help someone down the road.

These two entries in PHP.ini are for how big of a file you can upload to the system:

post_max_size = 80M
upload_max_filesize = 50M

In this case, they were not the problem.

I also have : $config['maxImageResizePixelCount'] = 60000000; in my config.php file, which is more than enough in my case.

So what was the problem? I have my Maximum attachment file size in Options set to 1500KB. This number is what the file ends up as after the system takes it and compresses it to fit.

I tested a 10MB JPG file and it worked fine because the system took it and compressed it down to 700KB. PNG files don't compress as well because they're lossless, so a much smaller 2MB PNG file only compressed down to 1600KBMB and that failed because of my Maximum attachment file size being set to 1500KB.


Here's a Summary of options because I find some of the descriptions to be baffling.

PHP.ini
post_max_size = the largest chunk of "stuff" you can send via PHP at one time
upload_max_filesize = the largest size a single file can be that gets uploaded (within a single POST)

config.php
$config['maxImageResizePixelCount'] = this is the largest pixel size that you can send to the system. I have mine sent to 60000000 which is 60 megapixels. If I screenshot my ultrawide monitor the resulting image is 6400x2666 which is 17MP. The problem is people uploading pics from their phones which can be pretty huge.

Xenforo Admin Options (Seetup/Options/Attachments)
Maximum attachment file size = the largest file size you'll let the image processor make when compressing the original
Maximum attachment image dimensions = the largest pixel size you'll let the image processor make when compressing the original

The last two settings affect the final image - NOT the image you're uploading.
 
Back
Top Bottom