e2e4gu/adaptive-image-plugin

There is no license information available for the latest version (dev-master) of this package.

AdaptiveImages plugin for CakePHP 3

dev-master 2015-12-15 05:34 UTC

This package is not auto-updated.

Last update: 2022-08-10 08:32:15 UTC


README

Requirements

PHP extension - Imagick

sudo apt-get install php5-imagick

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require e2e4gu/adaptive-image-plugin

Add to /config/bootstrap.php

Plugin::load('AdaptiveImages', ['autoload' => true, 'routes' => true]);

or

Plugin::loadAll();

Add to main layout tag

<?= $this->Html->script('AdaptiveImages.client_screen') ?>

Helper includes in controller. Helper need for change src images path from original to cached.

public $helpers = ['AdaptiveImages.AdaptiveImg'];

Helper syntax. Your also can use Html helper`s options if you need it:

echo $this->AdaptiveImg->image('yourimage.jpg', ['semanticType' => 'original']);

You can add semanticTypes and resolutionBreakpoints in:

<your_local_project_dir>/vendor/e2e4gu/adaptive-image-plugin/config/adaptive_image_config.php
<your_local_project_dir>/config/adaptive_image_config.php

Config config syntax:

<semanticType> => [
    <breakpoint-001> => [
         <scale-method> => [
                <param-001> => <value-001>
         ]
    ]
]