Expand my Community achievements bar.

How to display image through script

Avatar

Level 2

Hi,

In my template I am passing image path through xml, I need to display this image on XDP template.

Please help for the same,

I tried

ImageField1.resolveNode("value.#image").href = "C:\\logo.jpg";

Image1.resolveNode("value.#image").url=".\logo.jpg";

But it doesn't help, Is I am doing any mistake or is there any other way.

Thanks,

Abhijit

2 Replies

Avatar

Level 2

Please give some suggestation, waiting for responce,

Thanks,

Abhijit

Avatar

Level 2

Got the solution,

first need to convert the imge into base 64 encoded string, and then pass it through xml.

do the binding with imageField, and make it readonly.

To covert image into base4 use below code

//convert image file into byte array this case - buf

String base64EncodedStr =

new sun.misc.BASE64Encoder().encode(buf);