-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hİ, I'am storing my images in mysql using hibernate without any problems. My MemberImages Table structure(id,filename,data,members_id).
The question is , how to display images using hibernate?
Please read the javadoc about AImage and Image.setContent
I mean get image from mysql database using hibernate and display it.
I save image with code below , but I can not get it and display !!!
fi = ((Media) media).getByteData();
((Image)getFellowIfAny("img")).setContent((org.zkoss.image.Image) media);
memberImage = new MemberImages();
memberImage.setName(name);
memberImage.setData(fi);
memberImage.setMembers_id(this.curr_member_id);
manager_memberImage.insert(memberImage);
Where the media come from? what is the mine type of this media? any code can show that?
Get the image data from the db and use the byte[] :
public createZKImagesFromByteArray(String imageName,byte[] imageData) { AImage alImage = new AImage(imageName,imageData); org.zkoss.zul.Image zkImage = new org.zkoss.zul.Image(); zkImage.setContent(alImage); org.zkoss.image.Image newImageFromDB = zkImage.getContent(); }
You can see here how to get both a org.zkoss.image.Image and a org.zkoss.zul.Image from byte[].
Once you have the image in the zk iimage classes you should be all set.
Asked: 2008-09-21 11:30:28 +0800
Seen: 1,082 times
Last updated: Sep 23 '08