[opencms-dev] Downscale large images automatically upon upload / create image resource

Paul-Inge Flakstad flakstad at npolar.no
Mon Sep 30 14:21:49 CEST 2013


Hi everyone,

I'm wondering:
Is there a built-in way to automatically downscale large images on upload (or perhaps upon "create image resource")? (For example, if the image exceeds a 1000x1000 px bounding box.)

If not, can I avoid touching core classes in OpenCms if I was to create such functionality myself? (Or: Can I add-on a custom "create image resource" handler class? How do I make OpenCms use it?)

Alternatively, is there a way to simply disallow upload of "large" (as defined by me) images?

Any advice is much appreciated! :)

Challenge:
Some editors don't bother to downscale images before uploading. This is a problem, because although all our images are downscaled in-page, we still link the in-page image to the original. Also, if the resolution is really huge, we could run into out-of-memory situations on the server when creating the downscaled versions displayed in-page on the site. (Especially if OpenCms was to initiate multiple downscales at roughly the same time - after flushing the image cache, for example.)

Imagined solution:
Eliminate the problem by setting a max resolution for images. Possibly implemented by automatically downscaling large images upon upload / create. Ideally I should also be able to override the restriction on a per-folder basis, for those special cases when a high-res image is actually called for.

Cheers,
Paul

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20130930/2f004f49/attachment.htm>


More information about the opencms-dev mailing list