rtLib — Notes Rich Text Management Library Documentation of rtLib — Notes Rich Text Management Library Download rtLib — Notes Rich Text Management Library FAQ of rtLib — Notes Rich Text Management Library Purchase rtLib — Notes Rich Text Management Library Feedback about rtLib — Notes Rich Text Management Library

Cookbook

Convert images to/from resources

Start search Mail feedback Back to Description


rtGraphic

add (rtContainer) appendText (rtContainer) appendText (rTextParagraph) Add (rtCollection) Add (rTextParagraph) exportToFile importFromFile Resource ResourceName saveAsResource

Code fragment from sample "Convert images to/from resources"; see full running samples in downloadable help.
const res1 = "BOX_RBOD.gif"
const res2 = "de.gif"
const aSample = "a_sample.gif"
const aBigFlag = "bigflag.gif"
Const theRes = "poltergeist.gif"

if ses.platform = "Macintosh" then
path = strLeft(ndb.FilePath,":") + ":"' default place(?) where it stores things without path (exported to in export sample)
Else
path = Environ("TEMP")
if path<>"" then path = path + "\"' it's a W32 client
End if

dim res as New rtGraphic(0)
res.ResourceName = theRes

dim g as New rtGraphic(0)
dim makeres as variant

makeres = false

if makeres then
g.importFromFile path &aBigFlag
g.saveAsResource "BIGFLAG", True, True ' Parms: 1) title, 2) rewrite existing, 3) hook to resource (instead of leaving as graphic)
'g.saveAsResource theRes, True, False ' Parms: 1) title, 2) rewrite existing, 3) leave as graphic
Else
g.ResourceName = res2' use existing
'g.exporttofile path &aSample
End if

ctxDump.appendText "Here goes the image: "
ctxDump.add g