When I needed to do that, I just copied and pasted the code out of GWT's ClientBundle image stuff:
private String toBase64(byte[] data) { // This is bad, but I am lazy and don't want to write _another_ encoder sun.misc.BASE64Encoder enc = new sun.misc.BASE64Encoder(); String base64Contents = enc.encode(data).replaceAll("\\s+", ""); return "data:image/jpeg;base64," + base64Contents; } (And I don't have to worry about IE since we were able to convince management that IE users could install ChromeFrame!) On Mar 16, 4:41 am, Amruta Deshpande <amv...@gmail.com> wrote: > I have a image in form of byte array on my server. I m encoding it > with base64 as follows > > byte[] bytes = bos.toByteArray(); > String base64 = > com.google.gwt.user.server.Base64Utils.toBase64(bytes); > base64 = "data:image/jpg;base64,"+base64; > > I am using GWT on client side. I want to display this image and trying > to build image object follws: > > public void setInput(DataSource input) { > Image image = new Image(myUser.getImg()); > this.setWidget(i, 4, image); > } > > but this is not working... can somebody help me? -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-toolkit@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.