Please or Register to create posts and topics.

Can we limit the resolution of uploads?

There is of course a parameter to limit the file size of uploads.  Is there a way to limit the resolution of uploads or is there a plugin that works with Asgaros to do this?  Any resolution in excess of 72 dpi is probably a waste for viewing online and we’d like to keep our already huge forum on a diet.

Thanks Thomas!  Have a wonderful holiday!

Hello @gespanne

There is currently no way to limit the resolution of uploads. Adding some kind of logic for this is not so easy:

  • its something which should only work for image-files
  • it has to work for different image-types
  • some image-manipulation library must be installed for this – if this is not the case, code written for this will just not work
  • rejecting an image caused by its resolution will throw more errors for the users (wrong filetype, wrong filesize, wrong resolution) which might be frustrating
  • to avoid this, some automated resolution-scaling have to be implemented

But the good news is: The media-library-functions of WordPress already have built-in functionalities for it. So instead of re-implementing this I would rather re-use the media-library of WordPress in some way. I have plans to revamp the entire upload-functionality in the future anyway so I guess this feature-request will be something which can be a part of this enhancement.

Currently I am working on a lot of other new functionalities (approving, polls, etc) so dont expect that this revamp will come very soon.

In the meantime I suggest you to reduce the allowed maximum-filesize which indirectly forces your users to scale an image down if its too big (higher resolution -> bigger filesize). On the other hand a low resolution doesnt guarantee a small filesize (think about animated gifs or png/psd files which contains a lot of image-layers).

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

I fix this on my forum by editing forum-uploads.php to add a “width=300” parameter to the img tag, then enable image optimization in Jetpack plugin. This causes the image links to be replaced with a Photon API url with the image resized and reformatted according to the width parameter and browser type. I also set custom Photon arguments to set the max image size for when it’s full screen. And finally, I’m using a custom Lightbox plugin to enable easy viewing of the uploads. Example at https://www.mgbjubilee.com/forum/topic/rlw-7w/

Asgaros has reacted to this post.
Asgaros