Download the PHP package sadovojav/yii2-image-thumbnail without Composer
On this page you can find all versions of the php package sadovojav/yii2-image-thumbnail. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii2-image-thumbnail
Yii2 image thumbnail
Create image thumbnails use Imagine. Thumbnail created and cached automatically. It allows you to create placeholder with service https://placeholder.com/, holder.js or Imagine
Features:
- Easy to use
- Use Imagine
- TinyPng compression
- Automaticly thumbnails caching
- Cache sorting to subdirectories
- Caching placeholder from URL (placeholdit.imgix.net)
- Use placeholdit.imgix.net
Installation
Composer
The preferred way to install this extension is through Composer.
Either run
or add to the require section of your
Config
Attach the component in your config file:
Parameters
- string
basePath
=null
- Base path - string
prefixPath
=null
- Prefix path - string
cachePath
=@runtime/thumbnails
- Cache path alias - integer
cacheExpire
=604800
- Cache expire time - array
options
- Other options (placeholder/quality/additional compression)
Default options:
Note
Placeholder type
-
- sadovojav\image\Thumbnail::PLACEHOLDER_TYPE_URL - get placeholder by url
-
- sadovojav\image\Thumbnail::PLACEHOLDER_TYPE_IMAGINE - create placeholder used Imagine
Using
Get cache image
This method returns Html::img()
Parameters
- string
$file
required - Image file path - array
$params
required - Image manipulation methods. See Methods - array
$options
- options for Html::img()
For example:
Get cache image url
This method returns cache image url
Parameters
- string
$file
required - Image file path - array
$params
- Image manipulation methods. See Methods
For example:
Get placeholder image
This method returns Html::img()
Parameters
- string
$file
required - must to beNull
- array
$params
required - Image manipulation methods. See Methods - array
$options
- options for Html::img()
For example:
Get placeholder url
This method returns path to placeholder image
Parameters
- string
$file
required - must to beNull
- array
$params
required - Image manipulation methods. See Methods - array
$options
- options for Html::img()
For example:
Method
Resize
Parameters
- integer
width
required - New width - integer
height
required - New height
Crop
Parameters
- integer
width
required - New width - integer
height
required - New height - integer
x
=0
- X start crop position - integer
y
=0
- Y start crop position
Thumbnail
Parameters
- integer
width
required - New width - integer
height
required - New height - string
mode
=THUMBNAIL_OUTBOUND
- Thumbnail modeTHUMBNAIL_OUTBOUND
orTHUMBNAIL_INSET
Placeholder
This method return image placeholder if image file doesn't exist.
Parameters
- integer
width
required - Placeholder image width - integer
height
required - Placeholder image height - string
backgroundColor
=#f5f5f5
- Background color - string
textColor
=#cdcdcd
- Text color - string
text
=No image
- Text
Watermark
Parameters
- string
image
required - watermark path - integer
posX
required - X/-X watermark position - integer
posY
required - Y/-Y watermark position - integer
width
- Watermark width - integer
height
- Watermark height - string
mode
=THUMBNAIL_OUTBOUND
- Thumbnail modeTHUMBNAIL_OUTBOUND
orTHUMBNAIL_INSET
Compression (TinyPng)
All versions of yii2-image-thumbnail with dependencies
yiisoft/yii2 Version *
yiisoft/yii2-imagine Version *
kinglozzer/tinypng Version 0.1.*