cancel
Showing results for 
Search instead for 
Did you mean: 

Handling dynamically generated Images

Former Member
0 Kudos

Hello,

I have a WDJ application that generates Images dynamically based on certain criterion. The dynamically generated images are put to the server using the code


  .....
  BufferedImage image = <rendered image ...>
  .........
  File outFile = new File( "Output.jpg") ;
  ImageIO.write( image, "jpg", outFile);
  
  /** Resource path is not set during the file creation  
   * as ImageIO throws IllegalArgumentException
   */

It gets saved to the folder <i><drive>\usr\sap\<SID>\JC<InstNo>\j2ee\cluster\server0\output.jpg </i> by default.

Now, how to show up this dynamically generated image in a Image UI element? I have tried setting the output file name to the attribute that is bound to the "Source" property of the Image UI element but it doosn't show up as WD runtime is doing a look-up in the folder <i>../../../resources/com.test/<projectName>/Components/com.test.<componentName>/</i>

Any pointers in this regard are highly appreciated.

Bala

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Bala,

Is it possible to use (I am just taking a wild guess here !)


WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(),  "Filename");

Regards,

Subramanian V.

Former Member
0 Kudos

Hello Subramanian,

Thanks for your response.

Already I tried it out. This code didn't work because the image file is NOT located under the standard mimes resouces folder but is under <i>C:\usr\sap\P13\JC00\j2ee\cluster\server0</i>.

Bala

Former Member
0 Kudos

Hi

Try this

Create the alias for the folder (C:\usr\sap\P13\JC00\j2ee\cluster\server0.)

1.Goto Visual Administrator->Http Provider->Aliases in the Runtime Tab.

2.Give the Alias Name and Path for the Folder.

3.The Image sorce like http://<Server>:<Port>/<Alias>/<image>.<ext>;

Kind Regards

Mukesh

Former Member
0 Kudos

Mukesh,

Could you eloborate point 3 and the need for doing it. Assuming that I have done these configurations, how do I access the images?

Bala

Former Member
0 Kudos

Hi

Create a string attribute and bind it to FileDownload UIElement's data property

You can assign the value at run time

wdContext.currentContextElement().set<PhotoURL>("url")

Kind Regards

Mukesh

Former Member
0 Kudos

Please read my post carefully. I am NOT using FileDownload UI element.

Former Member
0 Kudos

Hi

You can bind url with image's source,alt property .

Kind Regards

Mukesh

Answers (0)