shadesoft / image-bundle
An image editing bundle using PHP's GD library if other solutions fail for some reason.
Fund package maintenance!
Ko Fi
www.buymeacoffee.com/ShadeSoft
www.paypal.me/ShadeSoft
Installs: 156
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.0
- shadesoft/gd-image: ^2.0
- symfony/framework-bundle: ^2.3 || ^3.0 || ^4.0 || ^5.0
Requires (Dev)
- phpunit/phpunit: >=5.7
- twig/twig: ^2.0 || ^3.0
Suggests
- twig/twig: Required for Twig filters.
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.
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