-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,40 @@ | ||
yii2-images | ||
=========== | ||
its only test | ||
Yii2-images is yii2 module that allow attach images to any your model. | ||
|
||
You can attach, remove, resize images, | ||
set main image for model | ||
|
||
For instance: | ||
|
||
<pre> | ||
$model = Model::findOne(12); //Model must have id | ||
$model->attachImage('../../image.png'); | ||
$model->attachImage('../../image2.png'); | ||
|
||
//to get all images | ||
$images = $model->getImages(); | ||
foreach($images as $img){ | ||
//retun url to full image | ||
echo $img->getUrl(); | ||
|
||
//return url to proportionally resized image by width | ||
echo $img->getUrl('300x'); | ||
|
||
//return url to proportionally resized image by height | ||
echo $img->getUrl('x300'); | ||
|
||
//return url to resized and cropped image by width and height | ||
echo $img->getUrl('200x300'); | ||
|
||
|
||
} | ||
</pre> | ||
|
||
|
||
Installation: | ||
1) install from json | ||
2) run migration | ||
3) setup module | ||
4) setup behaviour | ||
5) check permissions |