Git Product home page Git Product logo

pdfthumb's Introduction

PDFThumb plugin for Craft CMS

Generate previews of PDF files.

Pre-requirements

PHP ImageMagick library must be installed.

How to use

Twig example*:

<div class="pdf">
    {% set params = { width: 640 } %}
    <img src="{{ pdfthumb.get(block.file.first().url, params) }}">
    <div class="centered"><div>
        <a href="{{ block.file.first().url }}"><i class="fa fa-expand"></i> PDF</a>
    </div></div>
</div>

where block.file.first().url is a URL of PDF file, and params can have width or height properties or both.

Screenshot

* CSS not included

Technical support

  • Commercial support, adaptation and custom development.
    Get help directly from project author.
  • Community support.
    You can submit questions, bug reports and feature requests to issue tracker. It's free, just no SLA guaranteed. Pull requests are welcome!

Looking for a project maintainer.

License

Copyright © 2015, 2016 Mikhail Emelchenkov. Source code is distributed under CDDL 1.0 open source license.

pdfthumb's People

Contributors

mildlygeeky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pdfthumb's Issues

Absolute URL being used as relative path

My Twig code looks almost exactly like the example code, yet I'm getting this error:

filemtime(): stat failed for /Users/lindseydiloreto/Sites/industrialassets/iamachinery/public/http://import.test/assets/brochures/0311.pdf

Clearly it's trying to read my absolute URL as a relative path... Is this a bug, or do I need to do something differently?

{% set pdf = entry.brochurePdf.first %}

<img src="{{ pdfthumb.get(pdf.url, {width: 470}) }}" />

Unable to open image. Using relative error.

I'm running my Craft build locally using MAMP and using a .com address. PDF file is accessible with http: added to the below address, but the plugin doesn't seem to be using it. It's trying to access it without (no doubt to prevent HTTP/S issues). How can I fix this and get it to pick up the correct file location?

Internal Server Error
unable to open image `//www.WEBSITEADDRESS.com/uploads/pdf/PDF-test-file.pdf': No such file or directory @ error/blob.c/OpenBlob/2695

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.