Giter Club home page Giter Club logo

thumber's Introduction

thumber

Creates image thumbnails from PDF files.

Thumber generates thumbnails from your PDFs. You can call thumber using a single tag in your template.

Example usage:

{exp:thumber:create src='/uploads/documents/yourfile.pdf' page='2' extension='jpg' height='250' class='awesome' title='Click to download' link='yes'}

Parameters:

  • src: The source PDF [Required]
  • base: Server path for use with files under different domains, for instance, when using MSM [Optional]
  • width: The width of the generated thumbnail [Default: 84]
  • height: The height of the generated thumbnail [Default: 108]
  • page: The page of the PDF used to generate the thumbnail [Default: 1]
  • extension: The file type of the generated thumbnail [Default: png]
  • link: Wrap the thumbnail in a link to the PDF [Default: no]
  • crop: Where width and height are both specified, crop to preserve aspect ratio [Default: yes]
  • url_only: Return the url of the image only [Default: no]

Any other parameters will be added to the img tag in the the generated html snippet – so if you want to add an id or class, just add them as parameters.

Optional config overrides:

  • $config['thumber_cache_dir']: Cache dir relative to public root [Default: /images/thumber]
  • $config['thumber_gs_bin']: Ghostscript "gs" binary [Default: gs]
  • $config['thumber_convert_bin']: Imagemagick "convert" binary [Default: convert]

Homebrew users:

Imagemagick/Ghostscript installed with Homebrew will likely be located in /usr/local/bin. If so, use the config override like so: $config['thumber_convert_bin'] = '/usr/local/bin/convert'

MAMP users:

If you get errors complaining about incompatible DYLD libraries, try putting this somewhere before the plugin is loaded (e.g. config.php, index.php): putenv("DYLD_LIBRARY_PATH=");

Requirements:

  • This plugin requires ImageMagick (v6.3.8-2 or newer) and Ghostscript
  • You must create a directory for your cached thumbnails to live. Thumber must have permissions to write to this directory. The default directory is specified as /images/thumber

### Todos:

  • Automatically create required directories
  • Improve caching (e.g. add an expiry time to cached images, and run a cache cleanup)
  • Add more parameters, e.g. max_width, max_height
  • Allow for tag pairs as well as single tags
  • Generate thumbnails for remotely hosted PDFs

thumber's People

Contributors

andylolz avatar peteeveleigh avatar

Watchers

Tim Kelty avatar James Cloos 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.