dev-master
9999999-devA Kohana module for create resized / cropped images.
MIT
The Requires
- composer/installers ~1.0
- php >=5.3.3
- kohana/image >=3.3
framework image kohana imagecache
A Kohana module for create resized / cropped images.
This module allows you to quickly create resized / cropped images. Modified images are cached after the initial request and served up thereafter to help reduce server strain,and also available, even when ImageCache switch off, on the same URL which was generated., (*1)
ImageCache currently works with Kohana 3.2 and 3.3, (*2)
In your application/bootstrap.php
file modify the call to Kohana::modules and include the image and imagecache modules., (*3)
Kohana::modules(array( ... 'image' => MODPATH.'image', 'imagecache' => MODPATH.'imagecache', ... ));
[!!] The image module is requried for the ImageCache module to work., (*4)
The default config files is located in MODPATH/imagecache/config/*
.
- Main configuration - MODPATH/imagecache/config/imagecache.php
- Configuration patterns for modify images - MODPATH/imagecache/config/imagecache_patterns.php
, (*5)
You should copy this files to APPPATH/config/*
and make changes there, in keeping with the cascading filesystem., (*6)
Empty or undefined options will always fallack to their defaults., (*7)
cache_expire: 604800 Number of seconds before the browser checks the server for a new version of the modified image., (*8)
cache_dir: 'cache/' Path to the image cache directory you would like to use, don't forget the trailing slash!, (*9)
quality: 80 The default quality of images when not specified in the URL., (*10)
scale_up: FALSE If the image should be scaled up beyond it's original dimensions on resize., (*11)
default_image: FALSE Default image if the requested image is not available. For example:, (*12)
'default_image' => 'files/misc/default.png',
watermarks Configure one or more watermarks. Each configuration key can be passed as a param through an Imagefly URL to apply the watermark., (*13)
If no offset is specified, the center of the axis will be used. If an offset of TRUE is specified, the bottom of the axis will be used., (*14)
// Example watermarks 'watermarks' => array( 'first_watermark' => array( 'image' => 'path/to/first/watermark.png', 'offset_x' => TRUE, 'offset_y' => TRUE, 'opacity' => 80 ), 'second_watermark' => array( 'image' => 'path/to/second/watermark.png', 'offset_x' => 5, 'offset_y' => 5, 'opacity' => 50 ) )
Example of pattern settings:, (*15)
'thumb' => array( 'width' => '50%', 'height' => '50px', 'crop' => TRUE, 'quality' => 80, 'watermark' => 'custom_watermark', ),
width Width of cached image. Allow 'px' or '%' suffix., (*16)
height Height of cached image. Allow 'px' or '%' suffix., (*17)
crop Use crop for cached image. If 'FALSE', then use scale., (*18)
quality Quality of cached image., (*19)
watermark Name of one of watermark from the main config file., (*20)
Here are some examples of what you can do with ImageCache., (*21)
At first set path of cache dir in your imagecache.php
.
For example:, (*22)
'cache_dir' => 'files/imagecache/',
At second set at least one pattern in your imagecache_patterns.php
.
For example:, (*23)
'thumb' => array( 'width' => '80', 'height' => '80', 'crop' => TRUE, ),
Use this path for get resized image
<img src="/files/imagecache/thumb/path/to/image.jpg">
, (*24)
A Kohana module for create resized / cropped images.
MIT
framework image kohana imagecache