Pelican Parts Forums

Pelican Parts Forums (http://forums.pelicanparts.com/)
-   Off Topic Discussions (http://forums.pelicanparts.com/off-topic-discussions/)
-   -   pictures and HTML and UN*X and Questions. (http://forums.pelicanparts.com/off-topic-discussions/284187-pictures-html-un-x-questions.html)

pmajka 05-22-2006 12:19 PM

pictures and HTML and UN*X and Questions.
 
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?

widebody911 05-22-2006 12:52 PM

Yeah, I have one that uses ImageMagick to create the thumbnails.

id10t 05-22-2006 12:52 PM

Code:

#!/bin/bash
for i in `ls -1 *jpg`
do
  echo \< img src=\"$i\"\>  >> htmlfile.htm
done

You could even pass it an arg, so you control what HTML file gets created

Code:

#!/bin/bash

for i in `ls -1 *jpg`
do
  echo \< img src=\"$i\"\>  >>$1
done


widebody911 05-22-2006 12:57 PM

(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.

widebody911 05-22-2006 12:59 PM

Let the shell glob it for you:

Code:

for i in *.jpg

id10t 05-22-2006 01:01 PM

widebody911 - put your code between brackets with "code" and "/code" as the contents like HTML tags, but with [ and ] instead of < and >

widebody911 05-22-2006 01:25 PM

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 &gt;&gt; $INDEX &lt;&lt; EOF
&lt;html&gt;
&lt;head&gt;
&lt;link rel=stylesheet href='http://www.yourdomain.com/style.css' TYPE='text/css'&gt;
&lt;!--
Thom Fitzpatrick
--&gt;
&lt;meta name='description' content='Thom Fitzpatrick'&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h4&gt;&lt;/h4&gt; &lt;p&gt;

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 &gt;&gt; $INDEX &lt;&lt; EOF
&lt;br clear=left&gt;
&lt;hr size=1&gt;&lt;p&gt;
&lt;a href=$each&gt;&lt;img src=_$each&gt;&lt;/a&gt; &lt;br clear=left&gt;

EOF
        fi
done


pmajka 05-22-2006 04:22 PM

Ah HA...Caught ya....THE GEEKS...THEY ARE HERE!!!!!..

seriously...thanks guys....this is exactly what i need.

pmajka 05-22-2006 04:36 PM

Too much time washing ans waxing this thing...

http://forums.pelicanparts.com/uploa...1148340943.jpg

david.avery 05-22-2006 04:41 PM

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.


All times are GMT -8. The time now is 04:53 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0
Copyright 2025 Pelican Parts, LLC - Posts may be archived for display on the Pelican Parts Website


DTO Garage Plus vBulletin Plugins by Drive Thru Online, Inc.