Export imageResource to an attachment

To all filetype wizzards out there…

The archaic application i’m working on crashes because of the amount of imageResources (8000!). I’m looking for a way to export the not-used part of them via script.

So far I’ve found “Eds Blue” database on the openntf site. It offers me a fine solution to export imageResources to the filesystem. From there I could pick them up en transform them into attachments, stored in a notesdoc.

Fact is that all of this has to take place scheduled on a server. I’d rather take the in-memory file and create an attachment directly, but how…?

By the way, this code is now used to write to disc:


Dim session As New NotesSession

Dim stream As NotesStream

Set stream = session.CreateStream

Call stream.Open(GstrPath + GstrImageName)

Call Base64ToBinary(Characters, stream)


Thnx

Arthur

Subject: export imageResource to an attachment

Arthur,

It can’t be done. NotesStream is always associated with a file on the hard drive, so you have to perform the extra step of doing file I/O.

Ken

Subject: RE: export imageResource to an attachment

Okidoki Ken, I’ll use the fileimport.Thnx for your response

Arthur

Subject: RE: export imageResource to an attachment

“NotesStream is always associated with a file on the hard drive …”

Is it? What about using Read or ReadText and Write or WriteText for in-memory strings and byte arrays?

I’m pretty sure that it can be done. The output of a NotesDXLExporter for each design note could be parsed for the encoded image data, this data could go to a NotesStream object. A NotesDXLImporter could take a prepared DXL (eg. stored in a string constant), replace the filedata with data from the NotesStream and finally create the required documents in the target database.

Subject: RE: export imageResource to an attachment

Harkpabst,

Before you can read or write text to a NotesStream, you have to open it first. The syntax for NotesStream’s Open method requires the path to a file on the hard drive. Therefore, I/O is unavoidable.

Ken