PHPackages                             andrej-griniuk/cakephp-html-to-image-view - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. andrej-griniuk/cakephp-html-to-image-view

ActiveCakephp-plugin[Templating &amp; Views](/categories/templating)

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

HtmlToImageView plugin for CakePHP

1.0.0(8y ago)1781MITPHP

Since Apr 21Pushed 8y ago1 watchersCompare

[ Source](https://github.com/andrej-griniuk/cakephp-html-to-image-view)[ Packagist](https://packagist.org/packages/andrej-griniuk/cakephp-html-to-image-view)[ Docs](https://github.com/andrej-griniuk/cakephp-html-to-image)[ RSS](/packages/andrej-griniuk-cakephp-html-to-image-view/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

[![Build Status](https://camo.githubusercontent.com/3fb5814ea9462a6709aadcc9fd5a9eab142010c96b8e7e0df5c234acdaffc4b0/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f616e6472656a2d6772696e69756b2f63616b657068702d68746d6c2d746f2d696d6167652d766965772f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/andrej-griniuk/cakephp-html-to-image-view)[![Coverage Status](https://camo.githubusercontent.com/b5507fefd3eb4cc4f3e30c073f67195ac45a091b9f8c7c4ea119591dda4feaa0/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f616e6472656a2d6772696e69756b2f63616b657068702d68746d6c2d746f2d696d6167652d766965772e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/andrej-griniuk/cakephp-html-to-image-view?branch=master)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE)

HtmlToImageView plugin for CakePHP
==================================

[](#htmltoimageview-plugin-for-cakephp)

This plugin renders html views as image (jpg or png) using `wkhtmltoimage` command line utility from [WkHtmlToPdf](https://wkhtmltopdf.org/) package.

Requirements
------------

[](#requirements)

- CakePHP 3.5+
- [wkhtmltoimage](https://wkhtmltopdf.org/)

Installation
------------

[](#installation)

You can install this plugin into your CakePHP application using [Composer](http://getcomposer.org).

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

Usage
-----

[](#usage)

First of all you need to load the plugin in your bootstrap.php

```
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.

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.

Default path to `wkhtmltoimage` binary is `/usr/bin/wkhtmltoimage`. You can change it by setting `HtmlToImageView.binary` configuration variable:

```
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)

For example:

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

See the full documentation and installation instruction for `wkhtmltoimage` at the [project website](https://wkhtmltopdf.org/)

Bugs &amp; Feedback
-------------------

[](#bugs--feedback)

License
-------

[](#license)

Copyright (c) 2018, [Andrej Griniuk](https://github.com/andrej-griniuk) and licensed under [The MIT License](http://www.opensource.org/licenses/mit-license.php).

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2941d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7a429c741847f43b7bfdc57ac33afaceaaeee837c694464357f893279398ef74?d=identicon)[andrej-griniuk](/maintainers/andrej-griniuk)

---

Top Contributors

[![andrej-griniuk](https://avatars.githubusercontent.com/u/2722793?v=4)](https://github.com/andrej-griniuk "andrej-griniuk (13 commits)")

---

Tags

wkhtmltopdfimagehtmlcakephpwkhtmltoimageviewhtmltoimage

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/andrej-griniuk-cakephp-html-to-image-view/health.svg)

```
[![Health](https://phpackages.com/badges/andrej-griniuk-cakephp-html-to-image-view/health.svg)](https://phpackages.com/packages/andrej-griniuk-cakephp-html-to-image-view)
```

###  Alternatives

[friendsofcake/cakephp-csvview

A CSV View class for CakePHP

1762.5M3](/packages/friendsofcake-cakephp-csvview)[wyrihaximus/twig-view

Twig powered View for CakePHP

804.7M1](/packages/wyrihaximus-twig-view)[dereuromark/cakephp-ajax

A CakePHP plugin that makes working with AJAX a piece of cake.

55255.9k1](/packages/dereuromark-cakephp-ajax)[ogheo/yii2-htmlcompress

Compress HTML output into a single line

20184.4k1](/packages/ogheo-yii2-htmlcompress)[dereuromark/cakephp-feed

A CakePHP plugin containing a RssView to generate RSS feeds.

1353.7k1](/packages/dereuromark-cakephp-feed)[view-components/view-components

Flexible Framework-Agnostic UI for Enterprise Web Applications

2498.7k7](/packages/view-components-view-components)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
