DominoWiki - Feature Request: Ability to easily add file resources (specifically images) to the content.Created on |
Apr 20, 2006 |
Created by |
Andrew Luke |
Status |
Submitted |
I wrote this mod for the WikiPage class convertSingleBrackets function.
'** [image:filename_id!!filename.ext left|right] should become an <img> tag to a file resource within the database
'This !! syntax is used for entering image resources (images contained in resource documents)
'If present we need to extract specific information from the string, see above for syntax
intLoc1 = Instr(newText, "!!")
If intLoc1 <> 0 Then
'Get the filename id (eg TheFriendlyName) and the specified filename (eg AttachedImage.jpg)
'With this we need to generate the image url eg /PATH TO DATABASE/WebFiles/KEY/$File/FILENAME
'WebFiles - is the view containing the image documents
'Key - is the filename id
'Filename - is the image filename with extension
intLoc2 = Instr(newText, " ")
fileID = Mid(newText, (Instr(newText, ":")+1), intLoc1-7)
If intLoc2 <> 0 Then
fileName = Left(Strright(newText, "!!"), Instr(Strright(newText, "!!"), " ")-1)
Else
fileName = Mid(newText, intLoc1+2, Len(newText)-intLoc1-2)
End If
imagePath = Evaluate(|"../webfiles/| & fileID & |/$file/| & fileName & |"|)
leftText = "image:" & imagePath(0)
rightText = Strright(newText, " ")
Else
leftText = Strleft(newText, " ")
rightText = Strright(newText, " ")
End If
Taken Actions by OwnersNo actions have been taken yet.Documents