demisang / yii2-image-uploader Goto Github PK
View Code? Open in Web Editor NEWYii2 behavior for upload image to model
License: GNU General Public License v3.0
Yii2 behavior for upload image to model
License: GNU General Public License v3.0
I need that the photos be stored in different folders
EXAMPEL
'savePathAlias' => '@frontend/web/images/products/' . $model->id,
Not work buttons to crop and delete no errors in the console, but button open file dialog
Provide a behavior to be attached to the model which deletes the image when the model is deleted
I want to load and crop few images for one model. I see it's don't possible at now, but mb you have an ideas or practice for do it?
I see on disk the original uploaded image is saved as xxxx_origina.jpg
. it would be nice to be able to obtain it
Please add messages translation, i.e. for crop and delete buttons
when i create the profile from profile page it showing only the choose file option and it is not giving the image to crop .
And i added all the code that you are posted in github to my document.
So please help to solve this issue
Не хочет устанавливаться.
Если устанавливать по инструкции то возвращает такую ошибку
Problem 1
- demi/image 1.2.2 requires yurkinx/yii2-image dev-master -> no matching pac
kage found.
- demi/image 1.2.1 requires yurkinx/yii2-image dev-master -> no matching pac
kage found.
- demi/image 1.2.0 requires yurkinx/yii2-image dev-master -> no matching pac
kage found.
- demi/image 1.1.2 requires yurkinx/yii2-image dev-master -> no matching pac
kage found.
- demi/image 1.1.1 requires yurkinx/yii2-image dev-master -> no matching pac
kage found.
- demi/image 1.1.0 requires yurkinx/yii2-image dev-master -> no matching pac
kage found.
- demi/image 1.0.0 requires yurkinx/yii2-image dev-master -> no matching pac
kage found.
- Installation request for demi/image ~1.0 -> satisfiable by demi/image[1.0.
0, 1.1.0, 1.1.1, 1.1.2, 1.2.0, 1.2.1, 1.2.2].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your min
imum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more det
ails.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further commo
n problems.
Installation failed, reverting ./composer.json to its original content.
Если пробовать установить версию 1.2.2 то просто пишет что не может найти расширение
yurkinx/yii2-image
'imageUploaderBehavior' => [
'class' => 'demi\image\ImageUploaderBehavior',
'imageConfig' => [
// Name of image attribute where the image will be stored
'imageAttribute' => 'image',
// Yii-alias to dir where will be stored subdirectories with images
'savePathAlias' => '@frontend/web/uploads/projects',
// Yii-alias to root project dir, relative path to the image will exclude this part of the full path
'rootPathAlias' => '@frontend/web',
// Name of default image. Image placed to: webrooot/images/{noImageBaseName}
// You must create all noimage files: noimage.jpg, medium_noimage.jpg, small_noimage.jpg, etc.
'noImageBaseName' => 'noimage.jpg',
// List of thumbnails sizes.
// Format: [prefix=>max_width]
// Thumbnails height calculated proportionally automatically
// Prefix '' is special, it determines the max width of the main image
'imageSizes' => [
'' => 1000,
'medium_' => 270,
'small_' => 70,
'my_custom_size' => 25,
],
// This params will be passed to \yii\validators\ImageValidator
// 'imageValidatorParams' => [
// 'minWidth' => 400,
// 'minHeight' => 300,
// ],
// Cropper config
'aspectRatio' => 4 / 3, // or 16/9(wide) or 1/1(square) or any other ratio. Null - free ratio
// default config
'imageRequire' => false,
'fileTypes' => 'jpg,jpeg,gif,png',
'maxFileSize' => 10485760, // 10mb
// If backend is located on a subdomain 'admin.', and images are uploaded to a directory
// located in the frontend, you can set this param and then getImageSrc() will be return
// path to image without subdomain part even in backend part
'backendSubdomain' => '/admin/',
],
],
когда добавляю этот код в behaviors выходит такая ошибка
Getting unknown property: backend\controllers\ProjectsController::validators
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.