BashImageGallery: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with "<source lang="bash"> # convert images to thumbnails + a webpage # with thumbnails and fancybox gallery cat << html > images.html <!DOCTYPE html> <html> <head> <meta chars...")
 
No edit summary
 
Line 1: Line 1:
NB: uses [[heredoc]]s to include big parts of HTML
<source lang="bash">
<source lang="bash">
# convert images to thumbnails + a webpage
# convert images to thumbnails + a webpage

Latest revision as of 13:58, 9 November 2020

NB: uses heredocs to include big parts of HTML

# convert images to thumbnails + a webpage
# with thumbnails and fancybox gallery

cat << html > images.html
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>

<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
<script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>

</head>
<body>
html

mkdir thumbnails
for i in *.png
do
    convert -resize 360x $i thumbnails/$i
    echo "<a data-fancybox=\"gallery\" href=\"$i\"><img src=\"thumbnails/$i\"></a>" >> images.html
done

cat << html >> images.html
</body>
</html>
html