Main Content

Magnolia Community Forums: Development: Magnolia imaging crop focus points


  • srood
    srood
    Full name: Simon
    Posts: 57
    Last post: Sep 14, 2016 10:37:35 AM
    Registered on: Oct 12, 2015
    Magnolia imaging crop focus points
    #1 by srood on Sep 14, 2016 10:37:35 AM

    Hey guys,

    Currently the magnolia imaging module cropping and resizing is working very nicely for us.
    I'm implementing responsive images, but would like responsive header images as well (which means I want to set a focal point on the images) --> for example; focus on top right and then crop image accordingly.

    What JAVA class would I have to change to edit the standard behaviour of the cropping focussing on the center of the image?

    I already looked into this java operation:
    https://nexus.magnolia-cms.com/content/sites/magnolia.public.sites/modules/magnolia-imaging/3.1.4/apidocs/info/magnolia/imaging/operations/cropresize/AutoCropAndResize.html#getEffectiveTargetSize(java.awt.image.BufferedImage, info.magnolia.imaging.operations.cropresize.Coords, info.magnolia.imaging.ParameterProvider)

  • had
    had
    Full name: Jan Haderka
    Posts: 1,405
    Last post: Feb 6, 2017 1:59:05 PM
    Re: Magnolia imaging crop focus points
    #2 by had on Sep 15, 2016 8:32:50 AM

    That seems indeed to be the right class to look at. Why are you still looking? :)

  • runger
    runger
    Full name: Richard Unger
    Posts: 571
    Last post: Feb 1, 2017 9:54:59 AM
    Re: Magnolia imaging crop focus points
    #3 by runger on Sep 15, 2016 8:41:22 PM

    Hi,

    I think you found it. The question is whether the focus point is a property of the image variation, of the image, or of the usage of the image.

    Case 1 is simple - just subclass or write your own version of the CropResize class, and configure a variation with image operation chain, then you can set the parameters on your CropResize class in the variation definition.

    Case 2 is also manageable, although you will probably have to write an ImageLoader which reads these properties from the image in JCR and puts them somewhere accessible for the resizer.

    Case 3 is probably the most interesting to implement, and the most complicated - in this case the parameters for the focus point need to be set in the link to the image when rending the page, and you will need to write a ParameterProvider and ImageGenerator that can work with them. Quite doable, but a little more work.

    Let us know how it goes.

    Regards from Vienna,

    Richard

    ________________________________________
    Von: dev-list-owner@magnolia-cms.com [dev-list-owner@magnolia-cms.com]" im Auftrag von "Simon (via Magnolia Forums) [forum@magnolia-cms.com]
    Gesendet: Mittwoch, 14. September 2016 10:37
    An: Magnolia Dev List
    Betreff: [magnolia-dev] Magnolia imaging crop focus points

    Hey guys,

    Currently the magnolia imaging module cropping and resizing is working very nicely for us.
    I'm implementing responsive images, but would like responsive header images as well (which means I want to set a focal point on the images) --> for example; focus on top right and then crop image accordingly.

    What JAVA class would I have to change to edit the standard behaviour of the cropping focussing on the center of the image?

    I already looked into this java operation:
    https://nexus.magnolia-cms.com/content/sites/magnolia.public.sites/modules/magnolia-imaging/3.1.4/apidocs/info/magnolia/imaging/operations/cropresize/AutoCropAndResize.html#getEffectiveTargetSize(java.awt.image.BufferedImage, info.magnolia.imaging.operations.cropresize.Coords, info.magnolia.imaging.ParameterProvider)

    --
    Context is everything: http://forum.magnolia-cms.com/forum/thread.html?threadId=939ebf13-a6ba-4e0e-aebf-40565277abb4

You don't have the permission to post on this thread

Sign in

To login on this forum, you can use your Magnolia Forge, Support or Partner account, or, below, your Google, Yahoo! or OpenID account. If you have trouble logging in, or any other sort of issue, please let us know in the Meta forum, on the user-list, or simply by email at forum-admin at magnolia-cms dot com.

* Required

... or sign in with:

  • icon http://{your-openid-url}
  • icon
  • icon https://me.yahoo.com/