Vaadin 7 + Crop Images

Hey!

I am new to Vaadin and I am loving it!

In my current project, I need the user to be able to crop an image with a given aspect ratio. I looked for an addon, but only found one for Vaadin 6 (https://vaadin.com/directory#addon/cropfield).

I read that one could integrate JavaScript into the application, but since I am very new to Vaadin and although the Book of Vaadin is a good point for starting, I do not really know how to proceed. Since vaadin-cropfield is a wrapper for JCrop, I thought it be a good idea to use this, but I am already stuck at how I can include more than one JavaScript (since JCrop requires JQuery if I understand right).

Since I think that I can not be the only one who is missing an image cropping addon, I thought it would be a good idea to ask here in the forum if someone already integrated JCrop or any other image cropping tool/lib into his/her Vaadin 7 application?

Hopefully there is someone around here and can either help me a little with the beginning and understanding of this, or even better with his/her cropping code!

Greeting,
Marcel

See e.g.
this post on stackoverflow
and the pages linked from it.

Note also that the parameter for @JavaScript is an array in case you are using that approach:

@JavaScript({ "a.js", "b.js" })
public class ...

If nothing else helps and you need to customize the bootstrap page (for code that needs to be included very early in the header of the page), you can check out BootstrapHandler and the related mini-tutorials
here
under “customizing the startup page”.

Hi,

thanks for the code, but that was not the problem. :wink: I just could not include them. It always gives an error that it could not be found.

I solved this (had the js not in the classpath…)

But nevertheless, I can not get it running correct. I googled a while and found out, that magnolia-cms uses JCrop with Vaadin and checked the code of them. I adopt the code, but only an image is showing, no JCrop.

The Code is in the attachement. Perhaps one can help me! :slight_smile:
13254.zip (130 KB)

Hi Marcel,

I’m facing the same problem. Did you get any further?

Thanks for reply!

Hello everyone,

I have downloaded the zip file and imported in my eclipse. Same things only image is coming but croping functionality is not comming. So please share some idea, if anyone have done this funtionality.

Thanks