BASH photo gallery: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with "```bash cat << EOF > index.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> div.image { float: left; } </style> </head> <body> EOF for i in *.JPG do t...")
 
No edit summary
Line 1: Line 1:
```bash
<source lang="bash">
cat << EOF > index.html
cat << EOF > index.html
<!DOCTYPE html>
<!DOCTYPE html>
Line 26: Line 26:
</html>
</html>
EOF
EOF
```
</source>

Revision as of 16:58, 15 July 2019

cat << EOF > index.html
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
<style>
div.image {
    float: left;
}
</style>
</head>
<body>
EOF
for i in *.JPG
do
t=${i%*.JPG}.thumb.jpg
if [ ! -f $t ]; then
    echo convert -resize 360x360 $i $t
    convert -resize 360x360 $i $t
fi
echo "<div class=\"image\"><a href=\"$i\"><img src=\"$t\" /></a></div>" >> index.html
done
cat << EOF >> index.html
</body>
</html>
EOF