Giter Site home page Giter Site logo

meteor-imgur's Introduction

Meteor Imgur Upload Package

meteor add simple:imgur

A meteor package that lets you upload images to Imgur. Is very nice to use with mdg:camera, as in the example app included in this repo.

API Documentation

Both API methods work on client and server.

Imgur.upload(options, callback)

Arguments

  1. options (required) an object with options, described below.
  2. callback(error, data) (required) a callback that is called with two arguments, 'error', and 'data'.
    1. error a Meteor.Error describing the reason the photo could not be uploaded.
    2. data an object that contains the response from the Imgur API, documented here. The most useful properties are data.link, which contains the URL of the newly uploaded image, and data.deletehash, which contains the id used for deleting the image later on.

Options

  • apiKey the Imgur Client ID. Get it by signing up for the API at https://api.imgur.com/oauth2/addclient.
  • image the image data, can be a base64-encoded image data string or the URL of an image somewhere on the internet.
  • mashapeKey optional Mashape key, necessary for commercial use apps. If provided, the method will request to the mashape endpoint instead of the regular imgur one.
  • type, name, title, description, album optional properties exactly as documented at https://api.imgur.com/endpoints/image#image-upload.

Imgur.toThumbnail(imageUrl, size)

Arguments

  1. imageUrl the URL for an image on Imgur, for example "http://i.imgur.com/wbJ84Wm.jpg".
  2. size the key of the desired thumbnail size, chosen from the list at the bottom of https://api.imgur.com/models/image. You can also use a constant from the list below.
    • Imgur.SMALL_SQUARE
    • Imgur.BIG_SQUARE
    • Imgur.SMALL_THUMBNAIL
    • Imgur.MEDIUM_THUMBNAIL
    • Imgur.LARGE_THUMBNAIL
    • Imgur.HUGE_THUMBNAIL

Imgur.delete(options, callback)

Arguments

  1. options (required) an object with options, described below.
  2. callback(error, data) (required) a callback that is called with two arguments, 'error', and 'data'.
    1. error a Meteor.Error describing the reason the photo could not be deleted.
    2. data an object that contains the response from the Imgur API, documented here. In this case, a boolean value.

Options

  • apiKey the Imgur Client ID. Get it by signing up for the API at https://api.imgur.com/oauth2/addclient.
  • deleteHash the delete hash, retrieved in the response object of the upload method
  • mashapeKey optional Mashape key, necessary for commercial use apps. If provided, the method will request to the mashape endpoint instead of the regular imgur one.

meteor-imgur's People

Contributors

sylvainbigonneau avatar

Watchers

James Cloos avatar Chemcee  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.