tlm/readfile-filter

Exposes readfile() to twig template filter.

1.0.2 2022-04-14 19:42 UTC

This package is auto-updated.

Last update: 2025-06-22 20:21:28 UTC


README

Exposes readfile() to twig template filter. Allows to display PDF files directly in the browser, obfuscating the real file path. Files of other types than PDF will download automatically.

Requirements

This plugin requires Craft CMS 3.0.0-beta.23 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require tlm/readfile-filter
    
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Readfile.

Using Readfile in your templates

{{ asset.one().url | readfile }}