on 06-11-2009 10:45 AM
Hi,
How to display image in Image UI element from byte array.
Regards,
H.V.Swathi
Hi,
If you have a byte array, then create a resource from it then get the url of the resource and set this value with image UI's Resource Property. Some thing like this...
IWDResource webResource = null;
ByteArrayOutputStream bOut=new ByteArrayOutputStream();
now get the image into this bOut
webResource=rsf.createCachedResource(bOut.toByteArray(),"My Test",WDWebResourceType.JPG_IMAGE);
after this generate an URL for this resource and map it with image UI's Resource Property Say Va_Resouce
wdContext.CurrentContextElement().setVa_Resouce(webResource.getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal()));
Thats it... you are done....
Regards,
SrinivaS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks for ur reply.
But i take that image in the form of byte [] from database.
byte[] bOut=wdContext.currentWaElement().getEmp_Image();
webResource=WDResourceFactory.createCachedResource(bOut,"My Test",WDWebResourceType.JPG_IMAGE);
wdContext.currentResourcesElement().setUploadImgResource(webResource);
wdContext.currentResourcesElement().setUploadImgURL(webResource.getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal()) );
Regards,
H.V.Swathi
Edited by: H.V Swathi on Jun 11, 2009 2:12 PM
Hi,
find this below code...
byte[] imagebyte = null;
InputStream in=null;
try {
con=condb.getConnection (mgnr);
stmnt=con.createStatement();
rs=stmnt.executeQuery("select * from VMS_Image");
//Pass_No,name,Image
while(rs.next())
{
mgnr.reportSuccess("Name :"+rs.getString("name"));
imagebyte=rs.getBytes("Image");
in=rs.getBinaryStream("Image");
mgnr.reportSuccess("Image>>"+imagebyte);
ByteArrayOutputStream bOut=new ByteArrayOutputStream();
int lenght=0;
byte part[]=new byte[10*1024];
while((lenght=in.read(part))!=-1)
{
bOut.write(part,0,lenght);
}
in.close();
after this use the code which i gave earlier...
Regards,
SrinivaS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.