[opencms-dev] Restrict the size of images uploaded to the workplace

Andreas Zahner a.zahner at alkacon.com
Wed Apr 2 10:57:25 CEST 2025


Hi Maria,

it is not possible to restrict the upload file size per type, but you 
can restrict the image dimensions for the upload as an alternative. This 
can be done by adding some parameters to the image loader element in the 
opencms-vfs.xml configuration file:

<loader class="org.opencms.loader.CmsImageLoader">
   <param name="image.scaling.enabled">true</param>
   <param name="image.scaling.maxsize">4000</param>
   <param name="image.scaling.maxblursize">9000000</param>
   <param name="image.scaling.downscale">w:1600,h:1200,q:97,c:transparent</param>
</loader>

In the parameter "image.scaling.downscale" you can configure the image 
target dimensions after the upload, in this case 1600 x 1200 pixels 
using a quality of 97%.

Kind regards,
Andreas.

-------------------
Andreas Zahner

Alkacon Software - TheOpenCms Experts
http://www.alkacon.com -http://www.opencms.orgAm 28.03.25 um 11:50 
schrieb Malu via opencms-dev:

> Hello everyone,
>
> I need to restrict the upload of images larger than 5MB to the 
> workplace. I've seen that you can restrict the size of files uploaded 
> to the workplace in the opencms-workspace.xml node:
> <maxfileuploadsize>-1</maxfileuploadsize>
> I've also seen that you can restrict the type of files uploaded, but I 
> don't know if you can restrict file sizes by type.
>
> Thank you for any hints!
> Best regards.
> Maria
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> https://lists.opencms.org/mailman/listinfo/opencms-dev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opencms.org/pipermail/opencms-dev/attachments/20250402/b0f7fc9a/attachment.htm>


More information about the opencms-dev mailing list