Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Module Search: Image cropping & Aspect ratio


Go to End


2 Posts   980 Views

Avatar
Faloude

Community Member, 55 Posts

1 April 2016 at 10:03pm

Edited: 01/04/2016 10:05pm

After a few hours of scavenging the web, I call on your help to find a module that solves an image problem.

Suppose you have a portrait placeholder (400 x 400) on one of your pages and an UploadField in the CMS that enables the user to place his own photo there. Now if the user uploads a 400 x 600 photo, it will obviously mess up the layout. User should be able to upload any photo, while the front-end output will be a 400x400 image. There are a few solutions out there:

Using CroppedImage(400,400)
This fixes the issue on the front-end. However, the user (read: confused client) will have no control how his photo is cropped. What if the most important part is cropped out?

Setting Upload constraints (400x400)
This would solve the issue on the back-end, but is not user friendly. My typical CMS user is not able to resize photos before uploading.

Using the FocusPoint module
Now we're getting close. This module enables the user to set a focus point area on the image that will be preserved when cropping. However, it still doesn't give full accurate control on cropping images as the desired solution below.

The desired solution
After uploading an image in the CMS, you can drag-and-drop a box that highlights the cropped image. Resizing the box is possible, preserving the fixed aspect ratio.

Avatar
Faloude

Community Member, 55 Posts

28 April 2016 at 1:26am

Found a mod that does this: https://github.com/willmorgan/silverstripe-cropperfield

But at this moment it's still heavily under development.