hexo-generator-thumb

Thumbnails generator plugin for Hexo

Usage no npm install needed!

<script type="module">
  import hexoGeneratorThumb from 'https://cdn.skypack.dev/hexo-generator-thumb';
</script>

README

hexo-generator-thumb NPM version

Generate thumbnails of images on directory to post.

Require

This plugin is dependenced on ImageMagick, so make sure ImageMagick is installed on your system.

On Ubuntu

$ apt-get install imagemagick

On Mac OS X

$ brew install imagemagick

On CentOS

$ yum install imagemagick

This plugin

Install

$ npm install hexo-generator-thumb --save

Configuration

# default values
thumb:
  sizes:
    l:
      width: 300
      height: 300
    m:
      width: 150
      height: 150
    s:
      width: 64
      height: 64
  overwrite: false # overwrite if the thumbnail exists

Example

thumb:
  sizes:
    large:
      width: 300
      height: 300
    midium:
      width: 150
      height: 150
    small:
      width: 64
      height: 64
    x-small:
      width: 40
      height: 40

# Result:
# ./source/_posts/hello-world/hello.png -> ./source/_posts/hello-world/large/hello.png
# ./source/_posts/hello-world/hello.png -> ./source/_posts/hello-world/midium/hello.png
# ./source/_posts/hello-world/hello.png -> ./source/_posts/hello-world/small/hello.png
# ./source/_posts/hello-world/hello.png -> ./source/_posts/hello-world/x-small/hello.png