![]() |
|
|
|
Registered
Join Date: Dec 2005
Posts: 1,284
|
![]()
So , i am a snappy kind of guy who likes to snap some pictures once in a while...
anyone have an app or script to take the contents of a directory (pictures in JPG format) and churn out a simple HTML file?
__________________
Have you ever felt suffocated while watching the Oxygen Channel? People with excuses fail. As soon as I OK my actions with an excuse, I cease bettering myself. 88 Carrera |
||
![]() |
|
Too big to fail
|
Yeah, I have one that uses ImageMagick to create the thumbnails.
__________________
"You go to the track with the Porsche you have, not the Porsche you wish you had." '03 E46 M3 '57 356A Various VWs |
||
![]() |
|
Registered
Join Date: Mar 2003
Posts: 10,346
|
Code:
#!/bin/bash for i in `ls -1 *jpg` do echo \< img src=\"$i\"\> >> htmlfile.htm done Code:
#!/bin/bash for i in `ls -1 *jpg` do echo \< img src=\"$i\"\> >>$1 done
__________________
“IN MY EXPERIENCE, SUSAN, WITHIN THEIR HEADS TOO MANY HUMANS SPEND A LOT OF TIME IN THE MIDDLE OF WARS THAT HAPPENED CENTURIES AGO.” |
||
![]() |
|
Too big to fail
|
(pasting isn't working because of the BB HTML translations.)
Basically loop thru the *.jpg files, and just use echo/print to create a hyperlink. For a nice touch, you can add header info, meta tags, etc.
__________________
"You go to the track with the Porsche you have, not the Porsche you wish you had." '03 E46 M3 '57 356A Various VWs |
||
![]() |
|
Too big to fail
|
Let the shell glob it for you:
Code:
for i in *.jpg
__________________
"You go to the track with the Porsche you have, not the Porsche you wish you had." '03 E46 M3 '57 356A Various VWs |
||
![]() |
|
Registered
Join Date: Mar 2003
Posts: 10,346
|
widebody911 - put your code between brackets with "code" and "/code" as the contents like HTML tags, but with [ and ] instead of < and >
__________________
“IN MY EXPERIENCE, SUSAN, WITHIN THEIR HEADS TOO MANY HUMANS SPEND A LOT OF TIME IN THE MIDDLE OF WARS THAT HAPPENED CENTURIES AGO.” |
||
![]() |
|
![]() |
Too big to fail
|
I lost some of the formatting, but this shoudl work
I denote thumbnails with an '_' as the leading character of the file name, which is why I glob the list of file names as I do; I could have made cleaner with sed, but oh well... Code:
#!/bin/sh INDEX="index.html" if [ ! -f "index.html" ] then cat >> $INDEX << EOF <html> <head> <link rel=stylesheet href='http://www.yourdomain.com/style.css' TYPE='text/css'> <!-- Thom Fitzpatrick --> <meta name='description' content='Thom Fitzpatrick'> <title></title> </head> <body> <h4></h4> <p> EOF fi for each in [a-zA-Z0-9]*.jpg [a-zA-Z0-9]*.JPG [a-zA-Z0-9]*.gif [a-zA-Z0-9]*.GIF [a-zA-Z0-9]*.TIF [a-zA-Z0-9]*.TIFF [a-zA-Z0-9]*.tif [a-zA-Z0-9]*.tiff [a-zA-Z0-9]*.png [a-zA-Z0-9]*.PNG do [ -f "$each" ] || continue [ ! -f "_$each" ] && convert -geometry 100 -quality 50 $each _$each grep -qw "$each" $INDEX if [ $? -ne 0 ] then cat >> $INDEX << EOF <br clear=left> <hr size=1><p> <a href=$each><img src=_$each></a> <br clear=left> EOF fi done
__________________
"You go to the track with the Porsche you have, not the Porsche you wish you had." '03 E46 M3 '57 356A Various VWs |
||
![]() |
|
Registered
Join Date: Dec 2005
Posts: 1,284
|
Ah HA...Caught ya....THE GEEKS...THEY ARE HERE!!!!!..
seriously...thanks guys....this is exactly what i need.
__________________
Have you ever felt suffocated while watching the Oxygen Channel? People with excuses fail. As soon as I OK my actions with an excuse, I cease bettering myself. 88 Carrera |
||
![]() |
|
Registered
Join Date: Dec 2005
Posts: 1,284
|
Too much time washing ans waxing this thing...
![]()
__________________
Have you ever felt suffocated while watching the Oxygen Channel? People with excuses fail. As soon as I OK my actions with an excuse, I cease bettering myself. 88 Carrera |
||
![]() |
|
Registered
|
There's a few freeware scripts out there that not only do this, they thumbnail and nicely format the HTML, with css support etc. Hit google and you'll see em. In the end, it's not hard, its about who spent the longest time and started from the nicest HTML template.
__________________
David Avery 05 Lotus Elise (sold) | 08 BMW 135i visit FocusedE, my e-business company | visit Spyderclub |
||
![]() |
|