2017 © Pedro Peláez
 

cakephp-plugin cakephp-html-to-image-view

HtmlToImageView plugin for CakePHP

image

andrej-griniuk/cakephp-html-to-image-view

HtmlToImageView plugin for CakePHP

  • Saturday, April 21, 2018
  • by andrej-griniuk
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Build Status Coverage Status License, (*1)

HtmlToImageView plugin for CakePHP

This plugin renders html views as image (jpg or png) using wkhtmltoimage command line utility from WkHtmlToPdf package., (*2)

Requirements

Installation

You can install this plugin into your CakePHP application using Composer., (*3)

composer require andrej-griniuk/cakephp-html-to-image-view

Usage

First of all you need to load the plugin in your bootstrap.php, (*4)

Plugin::load('HtmlToImageView', ['bootstrap' => true, 'routes' => true]);

This will enable jpeg and png extensions on any route. Alternatively you could load the plugin without 'routes' => true and only enable extensions on the routes you would like., (*5)

Layout path and templates sub dir are img, e.g. you'll need to create src/Template/Layout/img/defaut.ctp for your image views and and image view template would be, for example, src/Template/Events/img/view.ctp. Then simply call, for example, http://localhost/events/view.jpg to render your view as image., (*6)

Default path to wkhtmltoimage binary is /usr/bin/wkhtmltoimage. You can change it by setting HtmlToImageView.binary configuration variable:, (*7)

Configure::write('HtmlToImageView.binary', '/another/path/to/wkhtmltoimage');

You can pass some options to wkhtmltoimage from your view via $this->viewOptions(['imageOptions' => [...]). List of available options: - crop-h - Set height for cropping - crop-w - Set width for cropping - crop-x - Set x coordinate for cropping - crop-y - Set y coordinate for cropping - format - Output file format (jpg/png) - width - Set screen width, note that this is used only as a guide line (default 1024) - height - Set screen height (default is calculated from page content) - zoom - Zoom level - quality - Output image quality (between 0 and 100) (default 94), (*8)

For example:, (*9)

$this->viewOptions([
    'imageOptions' => [
        'width' => 250,
        'zoom' => 2
    ],
]);

See the full documentation and installation instruction for wkhtmltoimage at the project website, (*10)

Bugs & Feedback

https://github.com/andrej-griniuk/cakephp-html-to-image-view/issues, (*11)

License

Copyright (c) 2018, Andrej Griniuk and licensed under The MIT License., (*12)

The Versions

21/04 2018

dev-master

9999999-dev https://github.com/andrej-griniuk/cakephp-html-to-image

HtmlToImageView plugin for CakePHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andrej Griniuk

cakephp html image view htmltoimage wkhtmltopdf wkhtmltoimage

21/04 2018

1.0.0

1.0.0.0 https://github.com/andrej-griniuk/cakephp-html-to-image

HtmlToImageView plugin for CakePHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andrej Griniuk

cakephp html image view htmltoimage wkhtmltopdf wkhtmltoimage