Thank you Xi, this is a excellent solution, this helps me very much, God bless you.
El viernes, 16 de septiembre de 2011 11:02:54 UTC-5, Xi escribió: > > Hi, > > I've used http://sourceforge.net/projects/migbase64/ in my > application, to convert the byte array to a base64 string, which works > pretty well and efficient > My code is like : String base64 = "data:image/png;base64," + > Base64.encodeToString(bytes,false); > And at the client side, you just set the value into an image > element's "src" attribute. > > But be careful, IE CAN NOT take charge of an image that bigger > than 32KB by using the "Base64" way. > > Hope this can help you. > > On 16 sep, 12:54, AgitoM <[email protected]> wrote: > > Hi all, > > > > From a web service I am receiving a byte array that represents a > > image. > > I need to somehow squeeze this byte array into a image widget or > > similar widget on my client side. > > > > First I tried to convert the byte array to a base64 string: > > String base64 = Base64Utils.toBase64(image); > > base64 = "data:image/png;base64,"+base64; > > > > This didn't work. The developer of the web service informed me that I > > should not convert the byte array to a base64 string, and just use it > > directly. > > > > To test if the byte array represented a correct image, I saved the > > byte array to a physical image: > > InputStream in = new ByteArrayInputStream(image); > > BufferedImage bImage = ImageIO.read(in); > > > > File outputfile = new File("saved.png"); > > ImageIO.write(bImage, "png", outputfile); > > > > This succesfully resulted in a physical image being created. > > > > However I don't want to write the file and then send the URL to the > > image widget on my client side. > > > > Anybody have any suggestion about how I can get this byte array > > squeezed into a image? > > Or convert this byte array to a base64 string that does work? -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/4fCxWzvJ6YIJ. 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.
