[ Date Index ][
Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]
On Mon, Sep 24, 2001 at 09:19:00PM +0100, morgad wrote: > hi, > anyone got any suggestions for processing a pile of jpegs in the same > way ? i have come back from a weekend in cornwall with about 100 > pictures from the digital camera, and want to : > > a) generate the 25% scale thumbnails for each one (see > www.eclipse.co.uk/morgad/pictures/big/ and > www.eclipse.co.uk/morgad/pictures/thumbnails/ for the ones i did by > hand with adobe photodeluxe You need to find a graphics package that can run as a filter, I'm sure someone else knows how to do that. > b) (for bonus points) generate the html code for them with sizes, > filenames, etc. (see www.eclipse.co.uk/morgad/lug-dawlish.html for the > sort of code i mean) Try the attached script (You'll probably want to hand-edit the titles of the pictures, all I can do automatically is use the jpeg filenames) Keith -------------------------------------------------------------------------
#!/usr/bin/tclsh #Here's a tcl script to make your html picture index. I've pretty much #copied the html coding from your original page. I'm assuming that #you've got a local mirror of your website and that this file has been #copied to the directory where you want the html file and that pictures #and thumbnails are in subdirectories pictures/big and pictures/thumbnails #and that they're all jpegs. #Remember to do "chmod 755 mkpixndx" #Then execute with "mkpixndx lotsapix A Whole Load More Pix" #This should create a file called "lotsapix.html" with the title # "A Whole Load More Pix" (or whatever you substitute on your command line) # --------------------------------------------------------------------------- # Take the first word of the command tail as the html filename set filename [lindex $argv 0].html #Open file for writing (if it already exists it will be trashed!) set HTML [open $filename w] #Write out the html header (remember to escape all the quotes) puts $HTML "<!-- X-URL: http://www.eclipse.co.uk/morgad/$filename -->" puts $HTML "<!-- Date: [exec date] -->" #NOTE You may need to comment out the next line for local testing puts $HTML "<BASE HREF=\"http://www.eclipse.co.uk/morgad/$filename\">\n" puts $HTML "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\">" puts $HTML "<HTML VERSION=\"3.2\">\n<HEAD>" puts $HTML "<META NAME=\"author\" CONTENT=\"david r morgan\">" #Use the remainder of the command tail as the html page title puts $HTML "<TITLE>[lrange $argv 1 end]</TITLE>\n</HEAD>\n<BODY>\n" #Write out a heading (here it's the same as the page title) puts $HTML "<H1>[lrange $argv 1 end]</H1>\n" #Go to the directory with the pictures in it cd kres/maps #Work through a list of all the the jpegs ... foreach pic [glob *.jp*] { #get the file size set size [lindex [exec ls -s $pic] 0]K #Here's where to put a command to make the thumbnails #Write the html code for each picture puts $HTML "<A HREF=\"pictures/big/$pic\">" puts $HTML "<IMG src=\"pictures/thumbnails/$pic\" ALT=\"$pic $size\"" puts $HTML "BORDER=3 WIDTH=256 hspace=10 vspace=6 align=middle>" puts $HTML "$pic $size<\A><BR>\n" } #End the loop and change back to the directory you came from cd ../.. #Finally write out the page bottom ... puts $HTML <HR> puts $HTML "<TABLE BORDER=\"0\" WIDTH=\"90%\" SUMMARY=\"bottom of window\">" puts $HTML "<TR>\n<TD WIDTH=\"10%\"><A HREF=\"index.html\">home</A></td>" puts $HTML "<TD WIDTH=\"10%\"></TD>\n<TD WIDTH=\"10%\"></TD>" puts $HTML "<TD WIDTH=\"20%\"></TD>" puts $HTML "<TD WIDTH=\"30%\"><sub>updated : \ <!-- datestamp:begin -->[exec date]<!-- datestamp:end --></sub></TD>" puts $HTML "<TD WIDTH=\"10%\"></TD>" puts $HTML "<TD WIDTH=\"10%\">\ <A HREF=\"mailto:morgad@xxxxxxxxxxxxx\">email me</A></td>" #Finish up the html code ... puts $HTML "</TR>\n</TABLE>\n<HR>\n</BODY>\n</HTML>\n" #And close the file close $HTML #End of File