Main Content

Magnolia Community Forums: Get help with Magnolia: vaadin app (CropImageAction), how to access asset?


  • prism
    prism
    Full name: Marc Johnen
    Posts: 10
    Last post: Apr 7, 2017 11:51:44 AM
    Registered on: May 11, 2016
    vaadin app (CropImageAction), how to access asset?
    #1 by prism on Apr 3, 2017 2:17:01 PM

    Hello everyone,

    I wrote a custom vaadin app based on
    info.magnolia.ui.mediaeditor.action.CropImageAction

    for setting a focal point and integrated it into the ui-mediaeditor. Everything is working fine so far except for one problem:

    I don't know how to get the image asset to save the coordinates of the focal point I set with javascript.

    Any hints on how to access the asset (via jcr) based on the available classes in the CropImageAction are highly appreciated.

    Greetings
    Marc

  • prism
    prism
    Full name: Marc Johnen
    Posts: 10
    Last post: Apr 7, 2017 11:51:44 AM
    Registered on: May 11, 2016
    Re: vaadin app (CropImageAction), how to access asset?
    #2 by prism on Apr 7, 2017 9:25:59 AM

    Maybe my question wasn't very clear in the first place, but I solved it by adding the AppContext to the constructor.

    public CropImageAction(MediaEditorActionDefinition definition, MediaEditorView view, @Named(MediaEditorEventBus.NAME) EventBus eventBus, EditHistoryTrackingProperty dataSource, AppContext appContext, SimpleTranslator i18n) {

    ...



    /**
    * Get path of asset from appContext
    * @return path of the asset
    */
    private String getAssetPath(AppContext appContext) {
    AppInstanceController controller = (AppInstanceController)appContext;
    Location location = controller.getCurrentLocation();
    String assetPath = location.getParameter().replaceAll(":edit", "");
    return assetPath;
    }


    But I guess there must be a more direct and elegant way.

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/