Genii Weblog

10 Ways to Use Midas - #7

Fri 21 Nov 2003, 02:33 PM



by Ben Langhinrichs
After missing a day due to my wife's birthday (duty calls), here is the next in my customer inspired list of the top ten ways to use Midas which I started a few days ago with  #10) Rich text comparisons with red-lining.  I now offer #7...


#7) Work with images in rich text and in image resources

Description
Midas has long allowed developers to access and modify images, referred to as graphics in some cases.  From the early days when all images were stored in internal Notes bitmap format to the current images that may be JPEG or GIF images, and may be stored in native form or as attachments or even URLs, and even image resources that may be included in a rich text field or on a form, Midas has given access to all of them.

History
The ability to import images has been available since Version 1.00 in June, 1997.  As additional formats have been added, Midas has been enhanced to handle the new formats, then to add image resources, and finally to modify the attributes on graphics such as alt text, image hotspots, and image flow (how text flows around the image).  As recently as Version 3.20, we have added the ability to convert Notes bitmap images into GIF images, thereby saving a great deal of space and making export of the Notes bitmap images possible.

Comparison with standard Notes/Domino functionality
Notes 6.x has incorporated some ability to access images, but mostly only to delete them or move them about.  There is no facility in the backend to import images, no facility to modify the attributes of the image, no facility to export or extract the images.  In short, the Notes model barely handles images at all.

Documentation
Documented in the Help database by looking at the properties, methods and events associated with importing, exporting and modifying graphics, including the AppendGraphic method, ExportGraphic methid and SetTargetProperties method, as well as a series of properties such as GraphicWidth and GraphicHeight, GraphicFormat (which shows whether the graphic is in Notes bitmap format, JPEG or GIF format or an image resource), and GraphicOffset, which the special offset needed to use in URL's which reference the graphic directly from the rich text.

On-line demo
None available at this time.

Sample Database
Graphics are used so extensively that there are no specific samples dedicated to their use, but graphics are used in samples such as Walden, Jose's Keyword Replacements, Generate HTML, Export To MS Word, etc.  If we add a Graphics-specific sample, I'll change this post to reflect that.
Sample Script Snippet
This is adapted from a Help database script:

Set rtchunk = rtitem.DefineChunk("Graphic 1")
found = False
While rtchunk.Exists And Not found
  If rtchunk.GraphicFormat = "Notes Bitmap" Then
    Call rtchunk.ConvertBitmaps("Format=GIF")
  End If
  Call rtchunk.ExportGraphic(path & doc.NoteID & "_" & rtchunk.GraphicFormat & "." & rtchunk.GraphicFormat)
  found = True
  rtchunk.GetNextTarget
Wend

Copyright © 2003 Genii Software Ltd.

What has been said:


70.1. pippo
(21/06/2004 23.02)

pippo


70.2. gongsx
(2004-07-30 19:20)

can i get image from domino using java?


70.3. Sharmila Tilwalli Athanikar
(04/14/2005 06:24 AM)

This is what I am doing :

Set rtchunk = rtitem.DefineChunk("Graphic 1")

While rtchunk.Exists

Msgbox "hello"

Msgbox rtchunk.GraphicFormat

rtchunk.GetNextTarget

Wend

I have two attachments and one embedded image in the rtf.

the rtchunk.GraphicFormat returns "Notes Bitmap" for all three.

Is there anyway to differentiate an image from an attachment using Script?