/****************************************************************************/ /* PicTag © Peter Langlois Jan 28 1999 */ /* This is a handy little script to inject HTML IMG tags into your HTML */ /* docs using Viewtek and RexxReqTools library (available, respectively, on */ /* Aminet in 'gfx/show' and 'util/rexx' directories). */ /* */ /* This script is fairly explicit - there is minimal error checking so if */ /* you load unexpected files or supply the wrong information then expect */ /* trouble. ie you will not get the correct tag if your image is greater */ /* than 9999x9999 pixels in size. */ /****************************************************************************/ /* A small file is created and then deleted. The default location is RAM: */ /* You may change that here if you wish. */ temploc = 'RAM:tempinfo' /* The directory where the pictures are located should be either in the */ /* same or a sub-directory of the calling HTML code. The code is written */ /* the way it is because CED uses device names and many requesters use */ /* label names - DH1: vs. Work:. */ addlib('rexxreqtools.library',0,-30) OPTIONS RESULTS ADDRESS CYGNUSED /* get directory name of HTML file */ STATUS DIRNAME dname = RESULT CHANGE CURRENT DIRECTORY dname /* get file name using ASL requester */ GETFILENAME '" " "Please select picture for IMG tag"' fname = RESULT fullname = fname /* pass file name to Viewtek and parse file info */ ADDRESS COMMAND Viewtek ">"||temploc fname IN /* get filename without path */ p = LASTPOS('/',fname) name = SUBSTR(fname,(p+1)) /* pick out width and height info */ if open(tempfile,temploc,'r') then do call seek(tempfile,108,B) line = readch(tempfile,10) call close(tempfile) end firstx = POS('x',line,1) width = SUBSTR(line,1,(firstx-1)) line = DELSTR(line,1,(8-firstx)) secondx = POS('x',line,1) height = SUBSTR(line,1,(secondx-1)) delete '>NIL: '||temploc /* get BORDER */ bor = rtezrequest('Do you want a border?','_Yes|_No',,'rt_reqpos=reqpos_centerwin') /* get ALIGN */ a = rtezrequest('Alignment of picture?','_Left|_Middle|_Right',,'rt_reqpos=reqpos_centerwin') if a==1 then ali='LEFT' else if a==2 then ali='MIDDLE' else ali='RIGHT' /* get ALT */ alt = rtgetstring(name,'Enter ALT information - CANCEL for blank',,,'rt_reqpos=reqpos_centerwin') /* get picture path relative to HTML document location */ newname = DELSTR(fullname,1,((POS(':',fullname))+LENGTH(DELSTR(dname,1,(POS(':',dname)))))) ADDRESS CYGNUSED TEXT ''||alt||'' exit