XF 2.0 Automatically resize images?

Engraver

Member
I see that activity is down on many internet forums, mostly because of facebook and instagram. Part of the reason is that uploading images is fast and painless.

I just migrated from vB to XF2 and am wondering if there's some sort of automatic image resizing so members can simply click to upload without having to resize on their computer or jump through other hoops in order to post images. Any suggestions will be appreciated. Thanks!
 
Images will be resized to whatever maximum dimensions in pixels you set in ACP >Settings> Attachments. NB: there is also a max attachment file size in KB.

Note that clicking is not necessary to upload, images can drag & dropped into a post.
 
Thanks @Mr Lucky. When I try to upload an image that exceeds 1024kb (the default setting) I get an error message saying the file is too large. So simply uploading a phone image won't work without resizing it first. Am I overlooking a way that XF can do this automatically? I don't see any options for that.

Incidentally, I only see attachment settings in acp>setup>options>attachments. I'm not seeing settings>attachments per your post.

Thanks much for your help!
 
Thanks @Mr Lucky. When I try to upload an image that exceeds 1024kb (the default setting) I get an error message saying the file is too large. So simply uploading a phone image won't work without resizing it first. Am I overlooking a way that XF can do this automatically? I don't see any options for that.

Incidentally, I only see attachment settings in acp>setup>options>attachments. I'm not seeing settings>attachments per your post.

Thanks much for your help!
Sorry, my mistake I was talking from memery. Must remember not to do that.

It is indeed acp>setup>options>attachments

If you are getting messages saying the file is too large, that means (I think) it is too large even after resizing to your maximum pixel dimensions.

For example I have attachment size set to 1500KB and dimensions to 1200 x 1200 pixels max

However if I upload a largish image that is 5MB and 3819px x 2344px it gets resized to 1200px x 737px and at the same time is reduced to about 300KB so it posts fine.

So all you need to is tweak those settings a bit until you get the max dimensions you want. If you actually want the max width to be 4000px you will need to up the size in KB (although I struggle to imagine why you need a 4000px image on a forum post)
 
Sorry, my mistake I was talking from memery. Must remember not to do that.

It is indeed acp>setup>options>attachments

If you are getting messages saying the file is too large, that means (I think) it is too large even after resizing to your maximum pixel dimensions.

For example I have attachment size set to 1500KB and dimensions to 1200 x 1200 pixels max

However if I upload a largish image that is 5MB and 3819px x 2344px it gets resized to 1200px x 737px and at the same time is reduced to about 300KB so it posts fine.

So all you need to is tweak those settings a bit until you get the max dimensions you want. If you actually want the max width to be 4000px you will need to up the size in KB (although I struggle to imagine why you need a 4000px image on a forum post)

Thank you @Mr Lucky! I copied your settings and uploaded a 6mb file and it's resized and the file size is 98kb! HUGE help! Thank you!
 
You're welcome. Unless you need the file size for other types of attachments, you can probably have it a lot smaller as it will equate to the dimensions and whatever jpg compression is used by xenforo. I would think it could be reduced to maybe 500KB if you want to stop huge PDFs for instance.
 
Sorry, my mistake I was talking from memery. Must remember not to do that.

It is indeed acp>setup>options>attachments

If you are getting messages saying the file is too large, that means (I think) it is too large even after resizing to your maximum pixel dimensions.

For example I have attachment size set to 1500KB and dimensions to 1200 x 1200 pixels max

However if I upload a largish image that is 5MB and 3819px x 2344px it gets resized to 1200px x 737px and at the same time is reduced to about 300KB so it posts fine.

So all you need to is tweak those settings a bit until you get the max dimensions you want. If you actually want the max width to be 4000px you will need to up the size in KB (although I struggle to imagine why you need a 4000px image on a forum post)

Is there anywhere else in Xenforo that this needs to be turned on? I constantly have people unhappy with having to resize images before uploading them, I just tried your settings and even with a 5mb limit and the max image size set to 1024x1024 I still get an image too large error.
 
If I want to upload a picture from my mobile phone (as an attachment), I get the message that my picture is too big, although I specified 5120KB and 960x960 in the settings. It does not minimize automatically?
 
You may be hitting a hard coded limit we have that prevents the resize of images that are too large. Of course with modern cameras taking larger and larger photos, the default limit of 20000000 is frequently getting hit.

The default limit should allow images up to 20 megapixels to be resized without issue.
PHP:
$config['maxImageResizePixelCount'] = 30000000;
The above being added to src/config.php will allow images up to 30 megapixels to be resized without issue.

To work out what the value needs to be, you just need to find out the actual pixel width/height of the image and multiply. For example if they are 5500 x 4500 that would be about 24 megapixel.

The reason it is set at 20 megapixel is because the memory requirements for resizing such a large image are fairly significant, so we block it at 20 megapixel but allow it to be increased if your server has capacity. If you do experience issues after raising the limit then, unfortunately, you would need more server resources (particularly memory) or have to accept that those larger images can't be uploaded.
 
How can it automatically resize the images uploading to the forum from e.g.Imgur?It is so slow when someone uploading a phone's picture dim 3840X2400 so I'd like it to uploading resized auto max 1920X1080 to forum or generally max width 1920pxls.Is that possible?
 
Back
Top Bottom