Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexmngn/ember-imgur
https://github.com/alexmngn/ember-imgur
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/alexmngn/ember-imgur
- Owner: alexmngn
- License: mit
- Created: 2016-02-08T18:04:51.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-02-09T03:11:42.000Z (almost 9 years ago)
- Last Synced: 2024-10-18T00:32:12.658Z (2 months ago)
- Language: JavaScript
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Ember-imgur [![Build Status](https://travis-ci.org/alexmngn/ember-imgur.png?branch=master)](https://travis-ci.org/alexmngn/ember-imgur)
This Ember Service allows you to upload and get images from imgur.
## Installation
```
ember install ember-imgur
```## How to use it
Setup your Client-ID in the `config/environment.js` file of your project.
```javascript
var ENV = {
imgur: {
clientId: 'YOUR_ID'
}
};
```Then, simply inject the service in your controller or anything else.
```javascript
export default Ember.Controller.extend({
imgur: Ember.inject.service()
});```
### Post an image
`imageData` is the base64 representation of the image. It shouldn't include the `data:image/png;base64,` prefix. You can also pass an URL.
```javascript
this.get('imgur').imagePost(imageData).then((result) => {
//Result from imgur
}).catch((result) => {
//Error
});
```### Get an image
```javascript
this.get('imgur').imageGet(imageId).then((result) => {
//Result from imgur
}).catch((result) => {
//Error
});
```Feel free to implement additional features to this addon.