-- Simple example program in Euphoria language to create a html -- page with all the picture files in the current directory. -- Just a raw skeleton you can adapt to your particular needs. -- Generic program, suposed to run on any OS. -- On Windows -- -- Marco Achury, 2008 -- Released to public domain. Feel free to use and modify. -- include file.e constant RUN_AS_CGI = 0 -- Set to 1 to run as cgi-bin script integer FN -- File number for output sequence DIR -- List of images found sequence CDate -- The current date sequence FDate -- Formated date for the foot note. sequence temp sequence image_paths -- wilcard strings for images image_paths = { "*.jpg", "*.gif", "*.png", "*.bmp", "*.pic", "*.img", "*.dib" } -- All must to be valid dir() string -- Add all the image format supported by -- your browser. DIR = {} -- Look for files with image extension for i=1 to length(image_paths) do DIR = DIR & dir(image_paths[i]) end for -- DIR = dir ("*.jpg") & dir ("*.png") & dir ("*.gif") & ("*.bmp") -- You may want to change the file extensions. -- You may want to change path for all or some of the extensions. -- Eliminate atoms returned when a -- dir() call was not succesfull temp={} for i=1 to length(DIR) do if sequence(DIR[i]) then temp=append(temp, DIR[i]) end if end for DIR=temp if RUN_AS_CGI then FN=1 puts(FN, "Content-type: text/html\n\n") else -- You may want to check first if output file exist. -- You may want to change the output filename or path. -- You may want to append to an existing file, change "w" to "a" FN = open ("output.html", "w") -- Open output file if FN=-1 then abort (1) end if end if puts (FN, "\n") puts (FN, "\n") puts (FN, "Put your title here\n") puts (FN, "\n") puts (FN, "\n") puts (FN, "\n") puts (FN, "

Put Your Head Line Here

\n\n") puts (FN, "Put your introductory text here\n
\n
\n
") for i=1 to length(DIR) do puts (FN, " \"Picture:\n
\n" ) -- Generates tag puts (FN, "File Name: " & DIR[i][D_NAME] & "
\n") -- puts File Name puts (FN, "File Size: " & sprint(DIR[i][D_SIZE]) & " bytes
\n") -- puts File Size puts (FN, "Dated: " & sprint(DIR[i][D_YEAR]) & "/" & sprint(DIR[i][D_MONTH]) & "/" & sprint(DIR[i][D_DAY]) & "\n
\n") -- Generates File Date puts (FN, "
\n
\n") end for CDate = date() FDate = sprint(1900+CDate[1]) & "/" & sprint(CDate[2]) & "/" & sprint (CDate[3]) FDate = FDate & " " & sprint(CDate[4]) & ":" & sprint(CDate[5]) puts (FN, "
Page generated: " & FDate & "
" ) puts (FN, "By genera.ex, an Euphoria powered script
") puts (FN, "\n\n") abort(0)