SI
SI
discoversearch

We've detected that you're using an ad content blocking browser plug-in or feature. Ads provide a critical source of revenue to the continued operation of Silicon Investor.  We ask that you disable ad blocking while on Silicon Investor in the best interests of our community.  If you are not using an ad blocker but are still receiving this message, make sure your browser's tracking protection is set to the 'standard' level.
Politics : GOPwinger Lies/Distortions/Omissions/Perversions of Truth -- Ignore unavailable to you. Want to Upgrade?


To: Skywatcher who wrote (139009)9/28/2008 5:37:29 PM
From: Thomas A Watson  Read Replies (1) | Respond to of 173976
 
I felt like playing with scripts so I reworked some and created
new ones that function with the older.

#!/bin/tcsh
# file /hda4/home/watson/bin/makeglassandmini.com
# file /hde3/home/watson/bin/makethumbnail.com -> /hda4/home/watson/bin/makeglassandmini.com
# file /hde3/home/watson/bin/make320list.com -> /hde3/home/watson/bin/makethumbnail.com
# file
# file
set command=`echo $0 | awk -F/ '{print $NF}' `
echo doing `which $command`
echo ""
echo $command $1 $2
echo ""

# this script creates a list of jpg files in current directory
# Each image is then processed in a foreach loop
# The image size is determined
# several types of thumbnail are created. a label raised and a non labeled raise.
# also vga and 1/2 vga images are also created in their own subdirectory.
# After all the images are created a simple web page is created pointing to the
# different size images.

# Copyright Tom Watson (C) 2003 watman.com
# Licensed under the Open Software License version 1.1
# License Text at opensource.org
# Developed on Red Hat Linux release 7.3 (Valhalla)
# rpm tcsh-6.10-6 ImageMagick-5.4.3.11-1 gawk-3.1.0-4 grep-2.5.1-1

########################### makeglassandmini.com ###################################

if ( $command == makeglassandmini.com ) then

echo making file list.
ls |grep -i \.gif >imglist
ls |grep -i \.GIF >>imglist
ls |grep -i \.jpg >>imglist
ls |grep -i \.JPG >>imglist

if ( $1 =="" ) then
set opt_size = 0
set opt_x = 0
set opt_y = 0
else
set opt_size = $1
endif


echo opt_size $opt_size line 30

if ( $opt_size == 1280 ) then
set opt_x = 1280
set opt_y = 960
if ( !( -e 1280x960 ) ) then
mkdir 1280x960
endif
endif

if ( $opt_size == 1024 ) then
set opt_x = 1024
set opt_y = 768
if ( !( -e 1024x768 ) ) then
mkdir 1024x768
endif
endif

if ( $opt_size == 800 ) then
set opt_x = 800
set opt_y = 600
if ( !( -e 800x600 ) ) then
mkdir 800x600
endif
endif

if ( $opt_size == 1600 ) then
set opt_x = 1600
set opt_y = 1200
if ( !( -e 1600x1200 ) ) then
mkdir 1600x1200
endif
endif

if ( $opt_size == 640 ) then
set opt_x = 640
set opt_y = 480
if ( !( -e 1024x768 ) ) then
mkdir 1024x768
endif

end

#build ftp command file
#auto generated ftp command string to place files
#this is created in the directory to be uploaded
# run command is ftp "domain.name" <put_page
set thisdir = `pwd`
set thissubdir = ` pwd | awk -F/ '{print $NF}' `
echo creating file put_page
echo The current path $thisdir
echo This local directory $thissubdir
echo prompt >put_page
echo mkdir $thissubdir >>put_page
echo cd $thissubdir >>put_page
echo pwd >>put_page
echo lcd >>put_page
echo mkdir thumbs >>put_page
echo mkdir 640x480 >>put_page
echo mkdir 320x240 >>put_page
#echo mkdir 160x120 >>put_page
echo put mini_list.html >>put_page
echo mput mvc\*.jpg >>put_page
echo # in the thumbs the g16 style is used in the autogenerated webpage >>put_page
echo mput thumbs/g16\*.jpg >>put_page
echo mput 640x480/mvc\*.jpg >>put_page
echo mput 320x240/mvc\*.jpg >>put_page
#echo mput 160x120/mvc\*.jpg >>put_page
exit
endif

################################# makethumbnail.com ###########################

if ( $command == makethumbnail.com) then
echo d
if ( !( -e thumbs ) ) then
mkdir thumbs
endif

if ( $1 == "" ) then
echo making file list.
ls |grep -i \.gif |tr -d @ >imglist
ls |grep -i \.GIF |tr -d @ >>imglist
ls |grep -i \.jpg |tr -d @ >>imglist
ls |grep -i \.JPG |tr -d @ >>imglist
set list = `cat imglist`
else
set list = $1
endif

foreach i ($list)
echo line 219 makelabelnail.com file is $i
makelabelnail.com $i
end
exit
endif

################################# makelabelnail.com ###########################

# called from makethumbnail.com
if ( $command == makelabelnail.com) then

set i = $1
set imgPing = `/usr/X11/bin/identify -ping $i |head -1 | tr -d [ | tr -d ] `
set IMAGE_X = `echo $imgPing |awk '{print $3}'|awk -Fx '{print $1}'`
set IMAGE_Y = `echo $imgPing |awk '{print $3}'|awk -Fx '{print $2}'|awk -F= '{print $1}'|awk -F+ '{print $1}' `

set namechar=`echo $i |wc -m`
@ namelength=$namechar
@ namelength*=3

set USE320=0
if ( $IMAGE_X > 319 ) then
set USE320=1
endif
if ( $IMAGE_Y > 319 ) then
set USE320=1
endif

set DO_THUMB=0
if ( $IMAGE_X > 239 ) then
set DO_THUMB=1
endif
if ( $IMAGE_Y > 239 ) then
set DO_THUMB=1
endif

if ( $USE320 ) then

if ( !(-e 320x240/$i) ) then
if ( !( -e 320x240 ) ) then
mkdir 320x240
endif
convert -geometry 320x240 $i 320x240/$i
endif

echo USING 320x240 $i
set XY=`identify 320x240/$i |P3 |P1 = |head -1`
set Xof=`echo $XY |P1 x`
set Yof=`echo $XY |P2 x`
echo XY $XY Xof $Xof Yof $Yof
@ Xcen = $Xof
@ Ycen = $Yof
@ Xcen /= 4
@ Ycen /= 2
@ xoff = $Xcen - $namelength
@ yoff = $Ycen - 4
if ( $yoff > 120) then
@ yoff = 113
endif
convert -geometry 320x240 $i -font Helvetica-Narrow-Bold -gravity south -stroke '#000C' -strokewidth 3 -annotate 0 $i
-stroke none -fill white -annotate 0 $i 320x240/"0th32"$i
endif

if ( -e 320x240/$i ) then
convert -geometry 160x120 320x240/$i -font Helvetica-Narrow-Bold -gravity south -stroke '#000C' -strokewidth 3 -ann
otate 0 $i -stroke none -fill white -annotate 0 $i thumbs/"0th16"$i
else
if ( $DO_THUMB) then
convert -geometry 160x120 $i -font Helvetica-Narrow-Bold -gravity south -stroke '#000C' -strokewidth 3 -annotate
0 $i -stroke none -fill white -annotate 0 $i thumbs/"0th16"$i
else
echo NO THUMB CREATED for $i
endif
endif
exit
endif

############################## make320imgsrc.com ################################

if ( $command == make320imgsrc.com) then

set port = 768
set port1 = 480
set land = 1024
set land1 = 640

if ( $1 == "" ) then
set baseref="http://e6.ath.cx/
else
set http=`echo $1|grep http:// |wc -l`
if ( $http ) then
set baseref=$1

else
echo Arg 1 must have http:// as part of the base reference.
echo EXIT bad usage.
exit
endif

set subdir=`echo $baseref | P4 \\\/`
# write html for a 320 table.
ls |grep -i \.gif |tr -d @ >imglist
ls |grep -i \.GIF |tr -d @ >>imglist
ls |grep -i \.jpg |tr -d @ >>imglist
ls |grep -i \.JPG |tr -d @ >>imglist
set list = `cat imglist`
echo \<html\> >320_$subdir.html

echo \<BODY TEXT=\#FFFFFF LINK=\#aFaFFF VLINK=\#FF00FF ALINK=\#00FF00 BGCOLOR=\#000000\> >>320_$subdir.html
echo \<HEAD\>\<TITLE\> 320_$subdir.html created by script make320imgsrc.com \<\/\TITLE\>\<\/HEAD\> >>320_$subdir.html
echo \<br\> This file created with /hde3/home/watson/bin/make320imgsrc.com >>320_$subdir.html
echo \<br\> This file part of /hde3/home/watson/bin/makethumbnail.com >>320_$subdir.html
echo \<br\> Created `date` >>320_$subdir.html
echo \<br\> baseref= $baseref >>320_$subdir.html
echo \<br\> thisfile= $baseref"320_"$subdir.html >>320_$subdir.html
echo \<br\> >>320_$subdir.html
echo \<center\> >>320_$subdir.html
echo \<table\> >>320_$subdir.html

echo making 00_putpage_$subdir
echo prompt > 00_putpage_$subdir
echo cd html >> 00_putpage_$subdir
echo mkdir $subdir >> 00_putpage_$subdir
echo cd $subdir >> 00_putpage_$subdir
echo pwd >> 00_putpage_$subdir
echo lcd >> 00_putpage_$subdir
echo pwd >> 00_putpage_$subdir
echo mkdir 320x240 >> 00_putpage_$subdir
echo mkdir thumbs >> 00_putpage_$subdir
echo put 320_$subdir.html >> 00_putpage_$subdir

@ newline = 1 # causes <tr> tags to be generated.
@ count = 0 # counts the number of items per table record.

foreach i ($list)

if ( !($count) ) then
@ newline = 1
else
@ newline = 0
endif

@ XGA = 0
set imgPing = `/usr/X11/bin/identify -ping $i |head -1 | tr -d [ | tr -d ] `
set IMAGE_X = `echo $imgPing |awk '{print $3}'|awk -Fx '{print $1}'`
set IMAGE_Y = `echo $imgPing |awk '{print $3}'|awk -Fx '{print $2}'|awk -F= '{print $1}'|awk -F+ '{print $1}' `
echo here file $i $IMAGE_X"x"$IMAGE_Y

if ( $IMAGE_Y > $IMAGE_X ) then
set IMAGE_TYPE = $port
else
set IMAGE_TYPE = $land
endif

set USE320=0
if ( $IMAGE_X > 319 ) then
set USE320=1
endif
if ( $IMAGE_Y > 319 ) then
set USE320=1
endif

set DO_THUMB=0
if ( $IMAGE_X > 239 ) then
set DO_THUMB=1
endif
if ( $IMAGE_Y > 239 ) then
set DO_THUMB=1
endif

set IMAGE_SIZE = `echo $IMAGE_Y"x"$IMAGE_X`
set ROOT_IMAGE_NAME = `echo $i |awk -F. '{print $1}'`

# echo ROOT_IMAGE_NAME $ROOT_IMAGE_NAME IMAGE_SIZE $IMAGE_SIZE USE320 flag $USE320

if ( $newline ) then
echo \<tr\> >> 320_$subdir.html
endif

if ( $USE320 ) then

echo \<td\>\<A HREF=\"$i\"\>\<IMG SRC=\""320x240/0th32"$i\" border=0 \>\<\/A\> >>320_$subdir.html
else
echo \<td\>\<A HREF=\"$i\"\>\<IMG SRC=\"$i\" border=0 \>\<\/A\> >>320_$subdir.html
endif

echo \<\/br\> $i $IMAGE_SIZE >> 320_$subdir.html
echo put $i >> 00_putpage_$subdir

echo \<\/br\> FULL \&lt\;img src\=\'$baseref$i\'\> >> 320_$subdir.html

if ( $USE320 ) then
if ( -e 320x240/$i ) then
echo \<\/br\> 320x240 \&lt\;img src\=\'$baseref"320x240/"$i\'\> >> 320_$subdir.html
echo "put 320x240/"$i >> 00_putpage_$subdir
echo "put 320x240/"$i
endif

if ( -e 320x240/0th32$i ) then
echo \<\/br\> 320x240 \&lt\;img src\=\'$baseref"320x240/0th32"$i\'\> >> 320_$subdir.html
echo "put 320x240/0th32"$i >> 00_putpage_$subdir
echo "put 320x240/0th32"$i
endif
endif

if ( $DO_THUMB ) then
if ( -e thumbs/0th16$i ) then
echo \<\/br\> THUMB \&lt\;img src\=\'$baseref"thumbs/0th16"$i\'\> >> 320_$subdir.html
echo "put thumbs/0th16"$i >> 00_putpage_$subdir
echo "put thumbs/0th16"$i
endif
else
echo NO THUMB for $i
endif

echo \<br\>\<A HREF=\"$i\"\> $i" "$IMAGE_SIZE\<\/\A\> >> 320_$subdir.html

if ( -e "thumbs/$i" ) then
set imgPing = `/usr/X11/bin/identify -ping thumbs/$i |head -1 | tr -d [ | tr -d ] `

set IMAGE_Xt = `echo $imgPing |awk '{print $3}'|awk -Fx '{print $1}'`
set IMAGE_Yt = `echo $imgPing |awk '{print $3}'|awk -Fx '{print $2}'|awk -F= '{print $1}'`
set IMAGE_SIZEt = `echo $IMAGE_Xt"x"$IMAGE_Yt`

echo \<br\>\<A HREF=\"thumbs\/$i\"\> Small $IMAGE_SIZEt\<\/\A\> >> 320_$subdir.html
endif

echo \<\/td\> >> 320_$subdir.html
@ count++

# table records are 3 wide count here is 1 2 3 4 is > 3 wide.
if ( $count > 2 ) then
echo \<\/tr\> >> 320_$subdir.html
@ count = 0
endif

end

echo \<\/table\> >>320_$subdir.html
echo \<\/center\> >>320_$subdir.html
echo \<\/html\> >>320_$subdir.html

exit
endif
###################### make320list.com ##################### obsolete