Giter VIP home page Giter VIP logo

middleman-thumbnailer's Introduction

Middleman Thumbnailer

Generate thumbnail versions of your jpeg & png images

Important Note

If you bundle update, you will probably get the following error:

/middleman-core-3.2.2/lib/middleman-core/configuration.rb:37:in \`method_missing': 
undefined method \`before_build' for Middleman::Application::MiddlemanApplication1:Class (NoMethodError)

middleman-thumbnailer will only (currently) work with the latest v3-stable branch of middleman from git. In your Gemfile use this (for now):

gem 'middleman', :git => 'https://github.com/middleman/middleman.git', branch: 'v3-stable'

Installation

Add this line to your Gemfile:

gem 'middleman-thumbnailer', :git => 'https://github.com/nhemsley/middleman-thumbnailer.git'

And something like this to your config.rb:

  require 'middleman-thumbnailer'
  activate :thumbnailer, 
    :dimensions => {
      :small => '200x',
      :medium => '400x300'
    },
    :include_data_thumbnails => true,
    :namespace_directory => %w(gallery)

If you have a file in images called (for example) background.png, thumbnail versions will be created called: background-small-200x.png background-medium-400x300.png

Config Options

:include_data_thumbnails the list of images will be included in the data-thumbnails attribute for each image displayed with the thumbnail helper

:namespace_directory only thumbnail images found within this directory (within the images directory of course)

##Helpers

thumbnail(image, size, [html_options]) will return the thumbnail image tag for the image of the named dimension/size

thumbnail_url(image, size) will return the url for the image of the named dimension/size

middleman-thumbnailer's People

Contributors

nhemsley avatar jagthedrummer avatar nullreff avatar walski avatar

Watchers

Rens Verschuren avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.