shadesoft/image-bundle

This package is abandoned and no longer maintained. The author suggests using the sbolch/gd-image package instead.

An image editing bundle using PHP's GD library if other solutions fail for some reason.

v1.3.1 2020-06-07 22:57 UTC

This package is auto-updated.

Last update: 2023-10-27 15:00:56 UTC


README

ABANDONED - Please use GDImage instead.

An image editing bundle using PHP's GD library if other solutions fail for some reason.

Latest Stable Version Build Status StyleCI Total Downloads License

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require shadesoft/image-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new ShadeSoft\ImageBundle\ShadeSoftImageBundle(),
        );

        // ...
    }

    // ...
}

Usage:

Usage with PHP

<?php
// src/Acme/DemoController.php

// ...
class DemoController extends Controller
{
    public function DemoAction(Request $request) {
        $img = '../../web/assets/temp.jpg';

        $imgSizer = $this->get('shadesoft_image.sizer');

        $imgSizer->thumbnail($img, 400, 300);
    }
}

Usage with Twig

{{ asset('/path/to/image'|thumbnail(400, 300)) }}
{# recommended to use with cache functionality enabled, see below #}

For usage details, please check the 'Parameters' and 'Available functions' sections of the shadesoft/gd-image documentation.

Cache

To enable cache, you just need to configure the bundle like below:

# app/config/config.yml for Symfony 2/3, and config/packages/shade_soft_image.yaml for Symfony 4

shade_soft_image:
    cache_directory: /path/to/desired/cache/directory