-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I want to get the byte[] data for an image that was created from a relative image path and setSrc(imagePath), but I can't use Image.getContent() since that returns null.
I am setting the image into the object using image.setSrc("/relativeFilePathToImage") I know I can create an AImage but only if I have the full path to the file, which I don't have. Is there another way to construct the image using a relative image path or using a different class that will allow me to extract the image as a byte[]?
This can help you be not.
<button label="Upload Image" onupload="@command('onUploadImg',media=event.media)" upload="true,maxsize=1000"/> @Command("onUploadImg") public void onUploadImg(@BindingParam("media") Media media) { try { if (media instanceof Image) { byte [] a = media.getByteData(); } } catch (Exception e) { CommonException.error(e); } }
@Command("onUploadImg")
public void onUploadImg(@BindingParam("media") Media media) {
try {
if (media instanceof Image) {
byte [] a = media.getByteData();
}
} catch (Exception e) {
CommonException.error(e);
}
}
Hello ansancle,
Also please check out the following forum post:
http://forum.zkoss.org/question/95645/how-to-get-image-lob-attribute-from-database-into-listcell/
Best Regards,
Darksu
Asked: 2016-06-08 18:16:24 +0800
Seen: 20 times
Last updated: Jun 11 '16