DXL Problem - inserting a jpeg without fixing height and width

Hi folks, looking for some help from a DXL guru if somebody’s listening. I’ve got a script that does the following to allow them to insert an image from a set of stored images:

  • Prompts them for the image (document) they want to attach

  • Gets the image document, and the DXL for the image from the tag

  • Adds the tags to the start and end of the dxl

  • inserts this dxl back into a document, and imports it.

For gif files, this works like a charm, and inserts the gif file in its original size.

For jpeg files, this fails unless the picture tag has height and width attributes. I can easily set these in my dxl before I pass it in, but I have no way of knowing what size my original image (That I got from the attached file) is, so I would have to guess.

So, I guess I’m asking this:

Is there a value I can put in the height and width attributes to allow the graphic to come up with its original size?

or

Is there a way to get the original size of the graphic (in pixels) from the DXL output of a document with the picture attached as a file attachment?

I’ll take an answer to either question.

Cheers,

Brendan

Subject: DXL Problem - inserting a jpeg without fixing height and width

Well you’re in luck. I’m showing how to do this exact same thing this week at Lotusphere. In Java you can do the following to get the width and the height:

int image_width = 0;

int image_height = 0;

Image img = Toolkit.getDefaultToolkit().getImage(file.getAbsolutePath());

while ((image_width = img.getWidth(null)) < 0) {

// wait for image to load

try {

  Thread.sleep(100);

} catch (InterruptedException e) {}

}

image_height = img.getHeight(null);

Reading through the above should give you a hint. If you by any chance is at Lotusphere come find me… :slight_smile: If you’re not go to Lotusphere 2007 – lekkimworld.com and download the sample Java code there. You want the code for the “import picture” demo.

Good luck.

/Mikkel Heisterberg

Visit my Notes/Domino blog @ http://lekkimworld.com

for posts on Notes/Domino and how to use Java in Notes/Domino…