or assign environmental/logical
return
endelse
endif
if keyword_set(image_http) then img=image_http else $
image_http=get_logenv('image_http')
if keyword_set(html_http) then html=html_http else $
html_http=get_logenv('html_http')
images=concat_dir(path_http,image_http)
htmls=concat_dir(path_http,html_http)
limages=concat_dir(top_http,image_http)
lhtmls=concat_dir(top_http,html_http)
if debug then begin
help,images(0),htmls(0),limages(0),lhtmls(0)
stop
endif
if n_elements(outfiles) eq 0 then outfiles=strarr(n_elements(genxfiles))
;--------------- file loop ---------------------------------------
for i=0,n_elements(genxfiles)-1 do begin
genxfile=genxfiles(i)
message,/info,"Working on file: " + genxfile
if not file_exist(genxfile) then message,"NO genx file found..."
break_file,genxfile, log, path, file, ext, ver
; --------- derive output file names for gif and thumbnail -------------
if not keyword_set(outfiles(i)) then outfile=file else outfile=outfiles(i)
outgif=concat_dir(images,outfile + '.gif')
outthumb=concat_dir(images,outfile + '_thumbnail' + '.gif')
outhtml=concat_dir(htmls,outfile + '.html')
if noupdate and file_exist(outhtml) then begin
message,/info,"NOUPDATE set and html file exists..."
message,/info,"NOT regenerating..."
endif else begin
; -------------- read genx, write gif -------------------------
restgen, file=genxfile(0), image, r,g,b,text=text
ssw_write_gif,outgif,image,r,g,b
sizeimage=file_size(outgif,/str,/auto)
lastupdate=ut_time() + ' UT'
;-------------------- - thumbnail ------------------------
if thumbnail then begin
message,/info,"Creating Thumbnail...."
if keyword_set(thumbfact) then tfact=thumbfact else tfact=$
(where(max([(size(image))(1),(size(image))(2)])/(lindgen(10)+1) le maxthumb))(0) > 1
message,/info,"Thumbnail factor: " + strtrim(tfact,2)
ssw_write_gif,outthumb,congrid(image, $
(size(image))(1)/tfact,(size(image))(2)/tfact), r,g,b
endif
; write html image desription
otext=$
['','','','XTITLE','','','']
if not keyword_set(title) then title=outfile
if keyword_set(header) then $
exestat=execute('sxt_html,outhtml,/header,title=title') else $
file_append,outhtml,str_replace(otext,'XTITLE',title),/new
imref=''
imginfo='' + strupcase(outfile) + '
' + $
'File Created: ' + lastupdate + $
'Full size [' + sizeimage + ']
'
thumbref=imginfo + '
'
break_file,[outgif,outthumb],log,path,file,ext,ver
relgif=concat_dir(limages,file(0)+ext(0)+ver(0))
relthumb=concat_dir(limages,file(1)+ext(1)+ver(1))
; --------- thumbnail link and reference (*** Forced ON ***)
if thumbnail then begin
file_append,outhtml, $
[str_replace(imref,'XIMG',relgif),str_replace(thumbref,'XTHUMB',relthumb)]
endif else begin
file_append,outhtml, $
[str_replace(imref,'XIMG',relgif),str_replace(thumbref,'XTHUMB',relthumb)]
endelse
file_append,outhtml, str2html(text, min_line=3,min_col=4)
; html close
if keyword_set(trailer) then $
exestat=execute('sxt_html,outhtml,/trailer,/credits') else begin
chkenv=get_logenv('address_http')
if chkenv ne '' then address=chkenv else $
address = ['sxtwww@sxt.space.lockheed.com', 'freeland@sxt1.space.lockheed.com']
trailer=['
','',address,'']
otext=[trailer,'','']
file_append,outhtml,otext
endelse
; ---------------------- finished writing html description ------------
endelse ; end of IF NOUPDATE ... BLOCK
; ------------ add image link to link list --------------------------
if keyword_set(addlink) then begin
case data_chk(addlink,/type) of
7: linkfile=addlink
else: begin
linkfile=get_logenv('mosaic_images')
if linkfile eq '' then linkfile= $
concat_dir(htmls,'data.html')
endcase
endcase
if not file_exist(linkfile) then begin
message,/info,"No image list file: " + linkfile
endif else begin
linkinfo=rd_tfile(linkfile)
; dont add existing file
newlist=(where(strpos(linkinfo,"Recent Gallery Additions") ne -1))(0)
if newlist(0) eq -1 then $
newlist=(where(strpos(linkinfo,"Recent Additions") ne -1))(0)
head='' + $
strupcase(str_replace(outfile,"_"," ")) + $
''
newinfo=[linkinfo(0:newlist),newline,linkinfo(newlist+1:*)]
message,/info,"Updating file: " + linkfile
file_append,linkfile,newinfo,/new
endif else message,/info,"Link to: " + outhtml + ' already exists"
endelse
endif
endfor
; ---------------------- end of file loop ---------------------------
return
end