Thanks for your reply, i have seen that post, the thing is , i can not get the byte array anyway..
coz i can not asscess the blob object...-_-!!!....even though i saw the post that can use the byte array or inputstream to show the image.... Nino.Martinez wrote: > > Search the forum:) > > http://markmail.org/message/hgkugvqm6x2hj3j5#query:wicket%20image%20webresource+page:1+mid:hgkugvqm6x2hj3j5+state:results > > > You could also just inject the provider and serve it if not loaded, eg > the method above + injection, I think thats the best option, as it > should be cluster safe.. > > or this: > > package zeuzgroup.application.utils; > > import java.awt.image.BufferedImage; > > import org.apache.wicket.markup.html.image.resource.DynamicImageResource; > > public class ImageResource extends DynamicImageResource { > > // has to save this. or get the image another way! > private byte[] image; > > public ImageResource(byte[] image, String format) { > this.image = image; > setFormat(format); > } > > public ImageResource(BufferedImage image) { > this.image = toImageData(image); > } > > @Override > protected byte[] getImageData() { > if (image != null) { > return image; > } else { > return new byte[0]; > } > > } > > /** > * 1 day! > */ > @Override > protected int getCacheDuration() { > > return 3600*24; > } > > } > > > shrimpywu wrote: >> hi, i want to upload a image from wicket and store it into dabase, how >> can i >> display it? >> >> in hibernate, i define the type as Blob to store the image, >> however, when i try to read it, >> get the input stream from blob >> >> it always complain that after serialzation, blog may not be asscessable. >> >> ///// >> item.add(new Image("imgItem", new Resource() { >> >> @Override >> public IResourceStream getResourceStream() { >> return new AbstractResourceStream() { >> >> public InputStream getInputStream() >> throws >> ResourceStreamNotFoundException { >> return >> blob.getBinaryInputStream(); >> } >> >> public void close() throws IOException { >> // close input stream >> } >> }; >> } >> }) ); >> >> //// >> >> can anybody give me any suggestion, >> >> Thanks..... >> > > -- > -Wicket for love > > Nino Martinez Wael > Java Specialist @ Jayway DK > http://www.jayway.dk > +45 2936 7684 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/hi%2C-i-want-to-upload-a-image-from-wicket-and-store-it-into-dabase%2C-how-can-i-display-it--tp20054038p20055451.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
