Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/alexmngn/ember-imgur


https://github.com/alexmngn/ember-imgur

Last synced: about 2 months ago
JSON representation

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.