https://ekito.github.io/ng2-cloudinary/demo/
Angular2 components for Cloudinary image back-end
Install through npm:
npm install --save ng2-cloudinary
## Usage
You may also find it useful to view the demo source.
This directive allows displaying Cloudinary image and apply transformations
import {Component} from '@angular/core';
import {CloudinaryImageComponent} from 'ng2-cloudinary';
@Component({
selector: 'demo-app',
template: '<cl-image public-id="public_cloudinary_id" [options]="options"></cl-image>'
})
export class DemoApp {
options: new CloudinaryOptions({ cloud_name: 'ekito'});
}
This service allows uploading files to cloudinary using ng2-file-upload dependency.
@Component({
selector: 'demo-app',
template: '<input type="file" ng2FileSelect [uploader]="uploader"/>',
})
export class DemoApp {
cloudinaryImage: any;
cloudinaryOptions: CloudinaryOptions = new CloudinaryOptions({
cloud_name: 'ekito',
upload_preset: '1234abcd',
autoUpload: true
});
uploader: CloudinaryUploader = new CloudinaryUploader(this.cloudinaryOptions);
constructor(){
let _self = this;
//Override onSuccessItem function to record cloudinary response data
this.uploader.onSuccessItem = function(item: any, response: string, status: number, headers: any) {
//response is the cloudinary response
//see http://cloudinary.com/documentation/upload_images#upload_response
_self.cloudinaryImage = JSON.parse(response);
return {item, response, status, headers};
};
}
All documentation is auto-generated from the source via typedoc and can be viewed here: https://ekito.github.io/ng2-cloudinary/docs/
- Install Node.js and NPM (should come with)
- Install local dev dependencies:
npm install
while current directory is this repo
Run npm start
to start a development server on port 8000 with auto reload + tests.
Run npm test
to run tests once or npm run test:watch
to continually run tests.
- Bump the version in package.json (once the module hits 1.0 this will become automatic)
npm run release
MIT