Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 1.61 KB

README.md

File metadata and controls

49 lines (33 loc) · 1.61 KB

Insight Media Logo

Statamic Pdf Thumbnailer

Statamic Pdf Thumbnailer automatically generates an image per uploaded PDF asset.

Particularly useful when you want to show image previews when linking to PDF files.

Features

  • Generates an image asset of the first page for every uploaded PDF
  • The uploaded PDF contains a relation to the image asset
  • Includes a page number selector, when an image preview other than the first page is needed
  • Includes a simple tag to show the image previews in your antlers templates

Requirements

You should have Imagick and Ghostscript installed. See issues regarding Ghostscript on the underlying Spatie package page.

How to Install

You can search for this addon in the Tools > Addons section of the Statamic control panel and click install, or run the following command from your project root:

composer require insight-media/statamic-pdf-thumbnailer

How to Use

In your antlers templates

For example, if you have an Assets fieldtype named 'catalogs', containing some Pdf's:

{{ catalogs }}

    <a href="{{ url }}">
        <img src="{{ pdf :to="thumbnail" }}">
        
        <!-- or when using glide: -->
        <img src="{{ glide src=thumbnail width="200" }}">
    </a>

{{ /catalogs }}