Stuck with p:imageCropper

UI Components for JSF
Post Reply
ansarbasha
Posts: 8
Joined: 11 May 2010, 19:48

11 May 2010, 19:59

Hi,

I'm using Primefaces in a seam application, i got a issue with p:imageCropper, here goes the issue description.

<p:imageCropper value="#{myImageCropper.croppedImage}" image="http://localhost/myWork/uploader/images/#{param['studentID']}.jpg"/>
if I pass the student ID as parameter to the page, action of

<p:commandButton value="Crop" action="#{myImageCropper.crop}" async="true" update="croppedImage"/>
will never get called, nothing works, how ever if i pass the actual image name hard coded like shown below

<p:imageCropper value="#{myImageCropper.croppedImage}" image="http://localhost/myWork/uploaded/images/STUDID001.jpg"/>
everything works fine, image gets croped and will be saved properly, if any one can help me resolving this issue it will be great.

Thanks in advance
ansar

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

13 May 2010, 01:07

What does imagecropper render as html when you try to pass a parameter?

ansarbasha
Posts: 8
Joined: 11 May 2010, 19:48

13 May 2010, 13:15

Hi Cagatay,

Thanks for your reply, if i pass the parameter, imagecropper properly renders/displays the image cropper (it displays correct student image),
now if I click crop p:commandButton, nothing happens. For my experimentation I replaced p:commandButton with h:commandButton then i get
error saying that it cannot convert the parameter passed (error printstack trace does not appear on console i just get error message on page).
I badly need some help here, i'm really stuck here not moving.

thanks
ansar

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

14 May 2010, 01:45

I think I got it, during crop process imagecropper tries to read the image, as your image path is based on a request parameter, it can't read it as it's a different request now. Try using a more stateful scope like view scope.

ansarbasha
Posts: 8
Joined: 11 May 2010, 19:48

14 May 2010, 13:51

Wow, it worked by getting the values from view scope, you saved my life and harrasment with the customer, thanks a lot buddy.
I know it was my mistake not Primeface components, even then you spent time I really appritiate, and Primefaces ROCKS !!!!!!
Its simply tooooooooooooooooooooo good.

Thanks
ansar

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

17 May 2010, 23:25

Glad it works ansar, enjoy PrimeFaces. ;)

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 10 guests