on 03-29-2008 4:19 PM
Hi, I have sucesfully displayed picture from context of type "Resource" to an Image child with binded to it context of type String. I use to it belov listed piece of code and it works fine:
FileResource = value attribute if type com.sap....Resource
Image = value attribut of type String binded to Image child
if (element.getFileResource() != null) {
element.setImage(element.getFileResource().getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal()));
}
Now I have encountered closely related problem (there is a smile with coding an upload as well but I was able to upload "something" != null.). I have a picture in Binary type (uploaded from mysql db). How do I display it in an Image child with String type context (you can bind other types of context to Image child than String)? Below code how I upload the image:
ResultSet rs = stUpdate2.executeQuery("SELECT * FROM photo");
while(rs.next())
{
byte[] b=rs.getBytes(1);
IWDResource res=WDResourceFactory.createCachedResource(b,"Image4",WDWebResourceType.JPG_IMAGE); IPrivateMyProjectView.IImageTableElement imageEle=wdContext.createImageTableElement();
imageEle.setImage3(b); //this is probably wrong, I tried bot "setImage3(res)" but I get error
//The method setImage3(byte[]) in the type IPrivateKartaPolakaView.IImageTableElement is not applicable for //the arguments (IWDResource)
//or
//imageEle.setImage3( res.getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal()));
// wdContext.nodeImageTable() .addElement(imageEle );
//how it should be but that provides me "The method setImage3(byte[]) in the type //IPrivateMyProjectView.IImageTableElement is not applicable for the arguments (String)" error
wdContext.nodeImageTable().addElement(imageEle );
ImageTable = Value Node
Image3 = value attribute of type binary
Please advice. Regards, Balmer.
Hi
If u wnat to diasplay an image ,
1)simply take the image and copy under src->mimes>components--->urcomponentcontroller(like Comp_proj1)
2)Then take a ui element image
3)then go to the properties of image and in the source property u can write the name of image(like abc.jpg)
Regards
Hazrath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
First of all, make a string context attribute, and bind ur image UI element's source name to it.
Then write the following code:
IWDResource l_resource = WDResourceFactory.createCachedResource(<variable of type byte[] whihch has the binary type>,"MyImage",WDWebResourceType.JPG_IMAGE);
String l_image = l_resource.getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal());
now set this l_image to the source context attribute.
check it out and let me know if it works.....
Regards,
Gita
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you can use Binary-to-text encoding for this purpose. refer to the link below
[http://en.wikipedia.org/wiki/Binary-to-text_encoding]
Thanks,
S-B
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.