Previous Topic

Next Topic

Book Contents

Book Index

ImportImageAsResource

Description:

The ImportImageAsResource is used to import an image into Lotus Notes as an Image Resource. This enables you to show the image directly in Notes views!!

Declaration:

Declare Function ImportImageAsResource Lib "VCII2LN.DLL" (_
Byval pstrNotesServer As String, _
Byval pstrNotesDatabase As String, _
Byval pstrNotesUNID As String, _
Byval pstrNotesFieldThumbnail As String, _
Byval iThumbnailWidth As Integer,_
Byval iThumbnailHeight As Integer,_
Byval pstrNotesFieldImage As String, _
Byval pstrFilename As String, _
Byval pstrImportOptions As String) As Long

Parameters:

Param

Description

pstrNotesServer

The Domino server or blank ("") if local.

The output from the NotesDatabase property Server works fine, such as:

db.Server

pstrNotesDatabase

The filename of the database containg the document. Either the relative filename (such as mail\tester.nsf) or the extact filename (such as c:\program files\lotus\notes\
data\mail\tester.nsf) may be used.

The output from the NotesDatabase property FilePath works fine, such as:

db.FilePath

pstrNotesUNID

The Document Unique ID of the document to work on. Note that this should be the textual string of the UNID.

Note that you can use the NotesDocument's property UniversalID, such as:

doc.UniversalID

pstrNotesFieldThumbnail

The field name of the rich text field to hold the thumbnail image. Note that this image must not be visible in any way in the Notes document. Otherwise the referenced image will disappear!

iThumbnailWidth

The width in pixels of the thumbnail

iThumbnailHeight

The height in pixels of the thumbnail

pstrNotesFieldImage

The field name of the rich text field to import the image into.

pstrFilename

The full filename of the image to import.

Starting from version 1.4 of II2LN you can also specify any http:// or file:// URL in this parameter

pstrImportOptions

Optional import options to control how the image is processed and imported

Returns:

Same return codes as ImportImage.


Usage:

lRc = ImportImageAsResource(_
db.Server,_
db.FilePath,_
strUNID, _
"Thumbnail",_
120,_
90,_
"Image",_
strOriginalFile,_
strImportOptions)

The sample above import the image stored in the variable strOriginalFile. First a thumbnail of the image will be created in the rich text field Thumbnail, and the thumbnail will have the size 120 x 90 pixels. Remember, the Thumbnail-field should not be visible in the forms presenting the document, otherwise the thumbnail image will disappear when the document later is modified!

Secondly, II2LN will import the image to another rich text field named Image. The Image field will contain a Notes Embedded Image of the image, and can be used in the form!

All the imports are controlled via the import options in the string strImportOptions.

Notes:

In order to display Image Resources directly in Notes views, a few tricks has to be performed. First and foremost, the Thumbnail-field above can't be visible in any form! Secondly, II2LN will create a set of hidden fields in the Notes document for you. The autogenerated fields are always prefixed with the fieldname in the parameter pstrNotesFieldThumbnail. In the example above, this was "Thumbnail". Below we use XYZ to indicate this prefix

The fields are:

Field

Description

XYZFilename

This text field will contain the Image Resource filename that was the result of the import. In order to keep correct referencing and not having a problem with duplicate filenames, the Image Resource filename is automatically generated by II2LN. The format of the filename is;

<NoteID><PrefixName>.<File Extension>

For example;
000056ABXYZ.jpg

XYZHeight

This number field contain the real height of the thumbnail image. Remember, II2LN will always calculate the best fit inside the specified X and Y parameters!

XYZWidth

This number field contain the real width of the thumbnail image.

II2LN create these extra fields to make it much easier for you to create a Notes view displaying the image resource. Learn all about that here.

Introduced in version:

1.2.0.0

See Also

Functions

Identification functions

ImportImage

AttachImage

ProcessImage

GetImageDimension

GetImageFromClipboard

GetTIFFFrameCount

GuessImageFormat

GuessImageFormatStrict