All Projects → kaimallea → Node Imgur

kaimallea / Node Imgur

Upload images to imgur.com

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Node Imgur

Fileshare
Debian/Ubuntu applet for screenshots and images sharing using popular online services
Stars: ✭ 35 (-78.26%)
Mutual labels:  images, imgur
Liked-Saved-Image-Downloader
Save content you enjoy!
Stars: ✭ 80 (-50.31%)
Mutual labels:  imgur, images
Stegbrute
Fast Steganography bruteforce tool written in Rust useful for CTF's
Stars: ✭ 134 (-16.77%)
Mutual labels:  images
React Intense
A React component for viewing large images up close 🔍
Stars: ✭ 152 (-5.59%)
Mutual labels:  images
Imgpush
Minimalist Self-hosted Image Service for user submitted images in your app
Stars: ✭ 144 (-10.56%)
Mutual labels:  images
Imgaug
Image augmentation for machine learning experiments.
Stars: ✭ 12,107 (+7419.88%)
Mutual labels:  images
Flews
A multi-service news app written in Flutter
Stars: ✭ 148 (-8.07%)
Mutual labels:  imgur
Lilliput
Resize images and animated GIFs in Go
Stars: ✭ 1,690 (+949.69%)
Mutual labels:  images
Paperclip Meta
Adds width, height, and size to paperclip images.
Stars: ✭ 157 (-2.48%)
Mutual labels:  images
Himawari.js
Download real-time images of Earth from the Himawari-8 satellite
Stars: ✭ 1,763 (+995.03%)
Mutual labels:  images
Ipyplot
IPyPlot is a small python package offering fast and efficient plotting of images inside Python Notebooks. It's using IPython with HTML for faster, richer and more interactive way of displaying big numbers of images.
Stars: ✭ 152 (-5.59%)
Mutual labels:  images
Instagramdownloader
Firefox and Chrome Extention which creates an download button for instagram images and videos and videos
Stars: ✭ 144 (-10.56%)
Mutual labels:  images
Picpic
A awesome image host service driven by github pages and github actions.
Stars: ✭ 135 (-16.15%)
Mutual labels:  images
Idenprof
IdenProf dataset is a collection of images of identifiable professionals. It is been collected to enable the development of AI systems that can serve by identifying people and the nature of their job by simply looking at an image, just like humans can do.
Stars: ✭ 149 (-7.45%)
Mutual labels:  images
Nuxt Image Loader Module
An image loader module for nuxt.js that allows you to configure image style derivatives.
Stars: ✭ 135 (-16.15%)
Mutual labels:  images
Rawloader
rust library to extract the raw data and some metadata from digital camera images
Stars: ✭ 153 (-4.97%)
Mutual labels:  images
Tinyrenderer
A brief computer graphics / rendering course
Stars: ✭ 11,776 (+7214.29%)
Mutual labels:  images
Datasets
🎁 3,000,000+ Unsplash images made available for research and machine learning
Stars: ✭ 1,805 (+1021.12%)
Mutual labels:  images
Imgur.sh
Bart's Imgur uploader bash script
Stars: ✭ 145 (-9.94%)
Mutual labels:  imgur
Awesomeimagepicker
Awesome Image Picker library will pick images/gifs with beautiful interface. Supports image or gif, Single and Multiple Image selection.
Stars: ✭ 160 (-0.62%)
Mutual labels:  images

Command-line Usage

Installation

npm install imgur -g

Usage

Pass binary image files, urls, and/or base64-encoded image strings as arguments. Globbing is supported.

Upload a single image:

imgur cat.png

Upload multiple images (globbing supported):

imgur cat.png cats.gif cats23.jpg

imgur ~/*.(jpg|png|gif)

imgur ~/Pictures/kittens/*.jpg ~/gifs/sfw/*.gif

Upload an image from another place on the web. Be sure to include http(s):

imgur --url https://octodex.github.com/images/topguntocat.png

Upload a Base-64 encoded image:

imgur --base64 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAmUlEQVQ4je2TsQ3CMBBFnxMa08WR2IQKJskIUNwMZAcYwWIQMs65JCUpEEIYW4pJy6v+6e6+/hVnnGsAzsCBMi7AsbbW/rIMsAU2xrnmkeruuzW7zgIw+JGbv6fGQpWzfy3HOsJlDQY/AlCv3jpF9oS5ZBOICKoB1YCIlCdQDR9127qyBHP5Gyw3CBXPr/qi709JHXE1S995AsqoJu8x78GsAAAAAElFTkSuQmCC

Saving a client id for subsequent use:

imgur --save f9ae01148b53261

Display saved client id:

imgur --show

Remove previously saved client id:

imgur --clear

Use a specific client id one time only (overrides saved id):

imgur --client-id f9ae01148b53261 --file ~/me.jpg

# Short-hand
imgur -c f9ae01148b53261 -f ~/me.jpg

Add images to an existing album by specifying an album ID:

imgur --album-id F8KTV --file ~/me.jpg

# Short-hand
imgur -a F8KTV ~/me.jpg

You must own the album. If it's an anonymous album you need to use the deletehash in place of the album ID.

Module Usage

Installation

npm install imgur

Usage

Requiring the module:

const imgur = require('imgur');

Dealing with client IDs:

// Setting
imgur.setClientId('aCs53GSs4tga0ikp');

// Getting
imgur.getClientId();

// Saving to disk. Returns a promise.
// NOTE: path is optional. Defaults to ~/.imgur
imgur
  .saveClientId(path)
  .then(() => {
    console.log('Saved.');
  })
  .catch((err) => {
    console.log(err.message);
  });

// Loading from disk
// NOTE: path is optional. Defaults to ~/.imgur
imgur.loadClientId(path).then(imgur.setClientId);

Dealing with API URL:

In order to change the API Url say Mashape URL, use setAPIUrl(MashapeURL)

//Setting
imgur.setAPIUrl('https://api.imgur.com/3/');

//If setAPIUrl() is not called, API URL is read from process.env.IMGUR_API_URL

//Getting
imgur.getAPIUrl();

Dealing with Mashape Key

Requests to the Mashape URL expects a X-Mashape-Key: MashapeKey header. Set Mashape Key by using setMashapeKey(MashapeKey) method. Note: Defaults to process.env.IMGUR_MASHAPE_KEY

//Setting
imgur.setMashapeKey(https://imgur-apiv3.p.mashape.com/);

//Getting
imgur.getMashapeKey()

Dealing with credentials:

For when you want to upload images to an account.

// Setting
imgur.setCredentials('[email protected]', 'password', 'aCs53GSs4tga0ikp');

Uploading files; globbing supported:

// A single image
imgur
  .uploadFile('/home/kai/kittens.png')
  .then((json) => {
    console.log(json.link);
  })
  .catch((err) => {
    console.error(err.message);
  });

// All jpegs in a specific folder
// to an album you own
const albumId = 'F8KTV';
imgur
  .uploadFile('/home/kai/*.jpg', albumId)
  .then((json) => {
    console.log(json.link);
  })
  .catch((err) => {
    console.error(err.message);
  });

// Multiple image types from home folder
imgur
  .uploadFile('~/*.(jpg|png|gif)')
  .then((json) => {
    console.log(json.link);
  })
  .catch((err) => {
    console.error(err.message);
  });

Searching images within the gallery:

The first argument should be a query to search and it's the only required option. The second argument is optional params to sort your query by.

  • sort - Accepts 'time', 'viral', or 'top' as a value. Defaults to top.
  • dateRange - Accepts 'day', 'week', 'month', 'year', or 'all' as a value. Defaults to all.
  • page - Accepts an integer (e.g. 1, 2, 3, 4) as a value. Defaults to 1.

Search returns an object with the query response as an array of objects that include an image's ID, title, description, views, etc.. and the params you sent with the request.

const query = 'cats';
const optionalParams = { sort: 'top', dateRange: 'week', page: 1 };
imgur
  .search(query, optionalParams)
  .then((json) => {
    console.log(json);
  })
  .catch((err) => {
    console.error(err);
  });

Fetching image data:

const kittenPic = 'mbgq7nd';
imgur
  .getInfo(kittenPic)
  .then((json) => {
    console.log(json);
  })
  .catch((err) => {
    console.error(err.message);
  });

Fetching album data:

const kittenAlbum = 'mbgq7nd';
imgur
  .getAlbumInfo(kittenAlbum)
  .then((json) => {
    console.log(json);
  })
  .catch((err) => {
    console.error(err.message);
  });

Creating an album:

imgur
  .createAlbum()
  .then((json) => {
    console.log(json);
  })
  .catch((err) => {
    console.error(err.message);
  });

Uploading URLs of images hosted elsewhere:

// Include http(s) when specifying URLs
imgur
  .uploadUrl('https://octodex.github.com/images/topguntocat.png')
  .then((json) => {
    console.log(json.link);
  })
  .catch((err) => {
    console.error(err.message);
  });

Uploading Base-64 encoded images:

const imgurFavicon =
  'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAmUlEQVQ4je2TsQ3CMBBFnxMa08WR2IQKJskIUNwMZAcYwWIQMs65JCUpEEIYW4pJy6v+6e6+/hVnnGsAzsCBMi7AsbbW/rIMsAU2xrnmkeruuzW7zgIw+JGbv6fGQpWzfy3HOsJlDQY/AlCv3jpF9oS5ZBOICKoB1YCIlCdQDR9127qyBHP5Gyw3CBXPr/qi709JHXE1S995AsqoJu8x78GsAAAAAElFTkSuQmCC';

imgur
  .uploadBase64(imgurFavicon)
  .then((json) => {
    console.log(json.link);
  })
  .catch((err) => {
    console.error(err.message);
  });

Uploading multiple images:

Upload an array of images of the desired upload type ('File', 'Url', 'Base64').

Returns an array of images (imgur image data).

imgur
  .uploadImages(images, uploadType /*, albumId */)
  .then((images) => {
    console.log(images);
  })
  .catch((err) => {
    console.error(err.message);
  });

Uploading an album:

Create a new album and upload an array of images of the desired upload type to it ('File', 'Url', 'Base64').

Returns an object with the album data and an array of images { data: {...}, images: [{...}, ...]}.

The third parameter is an optional fail safe, meaning if the array of images is empty or invalid, it will not fail, but returns an object with empty data and empty images.

imgur
  .uploadAlbum(images, uploadType /*, failSafe */)
  .then((album) => {
    console.log(album.data, album.images);
  })
  .catch((err) => {
    console.error(err.message);
  });

Deleting anonymous uploads

Delete an image based on the deletehash(generated during the image upload)

imgur
  .deleteImage(deletehash)
  .then((status) => {
    console.log(status);
  })
  .catch((err) => {
    console.error(err.message);
  });

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].