2022.2

Table Of Contents
(see"Variabledatainthetext"onpage708).Theywillshowupinthetemplateas they are.SVG
datawillbeinterpretedanddisplayedasanimage.Stringsandbase64-encodedstringsshowup
asstrings.Inorderforabase64-encodedstringtobeinterpretedasanimage,itmustbeadded
totheURLofanimage.
AddingCameradatatothetemplate
TheCamerawidgetsubmitsabase64-encodedstring,whichcanbeputinadatafieldusingthe
DataMapper.Whenthisdatafieldisdraggedintoatemplate,thestringwillshowupinthecontent,
insteadoftheimage.
Tomaketheimageappearinatemplate,thedatahastobeusedastheURLofanimage.
ThebelowproceduredescribeshowtouseCameradataasthesourceofanimageinsidea<div>con-
tainer.Thebenefitofthisapproachisthattheimageautomaticallyscalestothesizeofthecontainer.
1. ClicktheInsert Inline Boxicononthetoolbar.TheInsert Inline Boxdialogappears.
2. EnteranIDforthebox(anythingwilldo,aslongasithelpsyouidentifythebox)andclickOK.
Theboxisaddedtothetextflowandcanberesizedifneeded.
<p>
Div content goes here
</p>
3. SwitchtotheSourcetabandreplacethecontentofthebox:bythistext:
<img id="camera" src="" width="100%">
4. SwitchbacktotheDesigntab.Youwillseeasmall,emptyrectangleinsideatthetopoftheinline
box.
5. Right-clicktheemptyrectangleandchooseNew Script...inthecontextualmenu.TheEdit
Scriptdialogappears.TheselectorofthescriptisautomaticallysettotheIDoftheselectedele-
ment(#camera).
Alternatively,youcouldaddanewscriptontheScriptspaneandmakesurethattheSelector
fieldissetto#camera.
results.attr("src", record.fields.photo);
6. Enterthefollowingscriptcode:Thenameofthedatafield(inthiscase:photo)mustbethatofthe
Cameradatainyourdatamodel.
Thisscriptupdatestheattribute“src”withthefieldcontainingthebase64image.
7. ClickOKtosavethescriptandtoggletothePreviewmodetoseetheresult.Youshouldsee
yourimage.Whenyouresizetheinlineboxthatsurroundstheimage,theimageshouldberes-
izedaswell.
Page 556