Creates image thumbnails from PDF files.
Thumber generates thumbnails from your PDFs. You can call thumber using a single tag in your template.
{exp:thumber:create src='/uploads/documents/yourfile.pdf' page='2' extension='jpg' height='250' class='awesome' title='Click to download' link='yes'}
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
: Wherewidth
andheight
are both specified, crop to preserve aspect ratio [Default: yes]url_only
: Return the url of the image only [Default: no]path
: Override the base path for images above the web root
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.
$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]
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'
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=")
;
- 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