Great, this simple trick really works. Thanks a lot.
I implemented it in the following way:
Image userPicture = new Image( GWT.getHostPageBaseURL() +
umi.userPic.thumbPath + "?" + Random.nextInt(200));
On Sep 8, 12:04 am, Folke <[EMAIL PROTECTED]> wrote:
> Append a unique ID as query string of the image URL, i.e. the time the
> file was last modified as integer.
>
> /upload/images/12345.jpg?1220824911
>
> On Sep 7, 11:34 pm, Paul van Hoven <[EMAIL PROTECTED]>
> wrote:
>
> > I have a simple Widget where the user can set its user picture. It has
> > a fileupload and shows the user image. So when the user wants to
> > change his user picture, he simply clicks on the fileupload chooses
> > picture and this is then send to the server. On the server side the
> > picture is safed as "userId".jpg where userId is a unique integer
> > associated with each user. So everytime the user updates his foto, his
> > file named "userId".jpg is simply overwritten, keeps its name and
> > after the fileupload succeeded on the client side in the "public void
> > onSubmitComplete(FormSubmitCompleteEvent event)" method I make an RPC
> > call to the server to retrieve the new image data, such that the user
> > can see his newly changed picture. But there is a problem.
>
> > The image in the widget is constructed by
>
> > setupWidget() {
> > ....
> > Image userPicture = new Image( GWT.getHostPageBaseURL() +
> > umi.userPic.thumbPath );
> > userPicture.setPixelSize( umi.userPic.width, umi.userPic.height );
> > ...
>
> > }
>
> > So after having gotten the new image data from the server the method
> > setupWidget() is called andthe new picture gets the same path as the
> > old one was, since the "userId".jpg hasn't changed name but content.
> > The problem: The new image is not reloaded, i.e. the same image as the
> > old one is shown. But the size of the picture changes. So now I have
> > the old picture but poorly scaled. I've already tried not to create a
> > new image but to call "setURL()" on the "old" userpicture. But it
> > doesn't work either.
>
> > Why is the image not reloaded properly?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---