zoukankan      html  css  js  c++  java
  • linux shell 网页相册生成器

    功能介绍:以下相册包含了许多本地图片,点击缩略图,就会出现一幅放大的图片。通过img标签存储图片,使用for循环对当前目录下的所有图片进行迭代。通过convert命令初始化图片大小。我们将所有的图片生成了一个HTML相册index.html。

    如果系统没有convert命令:yum install ImageMagick -y

    convert命令详解,请参考以下文章

    https://www.cnblogs.com/beyang/p/7597819.html

    效果如下:

     

     #! /bin/bash

    echo "Creating album"

    mkdir -p thumbs

    cat <<EOF1 > index.html

    <html>

    <head>

    <style>

    body

    {

            470px;

            margin:auto;

            border:1px dashed grey;

            padding:10px;

    }

    img

    {

            margin:5px;

            border:1px solid black;

    }

    <style>

    </head>

    <body>

    <center><h1>  #Album title</h1></center>

    <p>

    EOF1

    for img in *.jpeg

    do

            convert "$img" -resize "100x" "thumbs/$img"

            echo "<a href="$img"><img src="thumbs/$img" title="$img"></a>" >> index.html

    done

    cat <<EOF2 >> index.html

    </p>

    </body>

    </html>

    EOF2

    echo Album generated to index.html

  • 相关阅读:
    使用RecyclerView打造Gallery
    Retrofit简介与使用方法(翻译)
    迷宫实现递归版本C++
    牛客笔试题
    牛客笔试题---求最长重复词长度之和
    C++句柄解析
    C++双向循环链表实现
    String C++完整实现。
    String写时拷贝实现
    顺序表操作补充(查找方法增加)
  • 原文地址:https://www.cnblogs.com/xiangbing123/p/15000624.html
Copyright © 2011-2022 走看看