home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 52
/
Amiga_Dream_52.iso
/
Amiga
/
Internet
/
Web
/
thumbnail.lha
/
thumbnail.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1998-05-05
|
4KB
|
122 lines
/* Taken from original script by Matthias Finger
Modified by Sebastien Boisvert for general use */
addlib("rexxsupport.library",0,-30,0)
BORDER=1 /* border width for our table */
GFXCON="work:images/gfxcon/GfxCon_68020 " /* Path for GfxCON (SPACE reqiered) */
FORMAT="GIF" /* Format for destination pictiure */
/* FORMAT="JPEG" */
QUALITY=85 /* Quality for jpeg destination */
VERBOSE=0 /* Verbose: 1=OFF, 0=ON */
OTHER="" /* Other options for GfxCON */
/* ------- You should know what you do, if you change anything below -------- */
Options results
signal on error /* Setup a place for errors to go */
signal on BREAK_C
if arg()==0 then exit
PARSE ARG pattern sizex sizey dest res . /* get pattern of files to scale (not wildcards), X Y sizes, destination directory for thumbnails*/
/* and optional intended X resolution */
pattern="."||upper(pattern) /* put proper extensions on the pattern and format; remove 'E' form 'JPEG' */
form="."||format
form=compress(form,"E")
if ~exists(dest) then
call makedir(dest) /* check if directory exists and create it if not */
dest=dest||"/"
dir = showdir('','f',',') /* make comma seperated list of files in directory */
say "Checking for new pictures..."
do while dir ~=""
parse var dir name "," dir . /* get next filename from list */
name=upper(name)
parse var name file (pattern) . /* look for the pattern (removing it from final result */
if file == name then iterate /* is final name same as filename? If so, not a matching file and skip this loop */
if exists(dest||"t_"||file||FORM) then iterate /* skip if thumbnail already exists */
call pragma("STACK",22000)
comm = GFXCON||file||pattern
IF(VERBOSE==1) THEN
comm = comm||' >NIL:'
comm = comm||' TO '||dest||'t_'||file||form||' FORMAT 'FORMAT
IF (UPPER(FORM)=="JPEG") THEN DO
comm = comm||' QUALITY 'QUALITY||' '
END
comm = comm||' '||OTHER||' BOXFIT '||sizex||' '||sizey
ADDRESS COMMAND comm /* make up command line and execute it */
END
/* create thumbnail table */
files=0
if res="" then res=800 /* resolution; 800 for X default */
dir = showdir(dest,"f",",")
do while dir ~="" /* get number of files */
parse var dir name "," dir .
files=files+1
end
dir = showdir(dest,"f",",")
if files>0 then do
max = res % ((border*2)+sizex+3) /* get maximum number of thumbnails that fit on one row */
if (files//max) ~=0 then do /* if all thumbnails don't fit all equally */
mostremainders=files//max
do temp=max to 2 by -1 /* figure out how many across will produce the least */
if files//temp > mostremainders then do
mostremainders=files//temp
max=temp
end
end
end
rows = files%max
if files//max ~=0 then rows=rows+1
file="output"
if open(file,"t_index.html","W") then do
say "Creating index page..." /* Create the index page */
call writeln(file,"<HTML>") /* Put the code in */
call writeln(file,"<BODY>")
call writeln(file,"<CENTER>")
call writeln(file,"<TABLE BORDER="||border||">")
do rows /* do the tables */
call writeln(file,"<TR>")
do max
parse var dir name "," dir .
if name="" then iterate
name=upper(name)
parse var name "T_" name (form) .
call writeln(file," <TD><A HREF="||name||pattern||"><IMG SRC="||dest||"t_"||name||form||" ALT="||name||pattern||" WIDTH="||sizex||" HEIGHT="||sizey||"></A></TD>")
end
call writeln(file,"</TR>")
end
call writeln(file,"</CENTER>") /* close off the HTML document */
call writeln(file,"</TABLE>")
call writeln(file,"</BODY>")
call writeln(file,"</HTML>")
close (file)
end
else
say "Can't open ouput file!!!"
end
exit
error:
BREAK_C:
exit