Coder Social home page Coder Social logo

unsplash-single-image's Introduction

Unsplash utility

Unsplash.com provides beautiful photographic images by a variety of photographers that are accessible via an api delivered through a CDN to registered developers.

The Unsplash API documentation is comprehensive but for many developers all they probably need is a way to use the api with their API KEY to obtain a fraction of the data that the api returns by default. The output.txt has a sample of the full output data from the api as a reference, if you need more or less than the default logged data in the index.js file

What this repo does

Uses the node.js unsplash api libraries to set up a simple nodejs app that takes an unsplash image code as a parameter and returns only the data that you need. It comes preconfigured to return:

  • url to CDN of regular sized image you specify as a parameter
  • text description of the image
  • url to unsplash.com photographer's portfolio
  • name of photographer

The last two are to enable you to accredit the photographer's work as per conditions of use

How to use this repo

  • You will need to register as a developer with unsplash.com to obtain an API key

  • Clone or install repo

  • Create a .env file as follows

NODE_ENV='development' //production ACCESS_KEY='MY_UNSPLASH_ACCOUNT_ACCESS_KEY'

  • npm install //install dependencies

  • at the command line run node index UNSPLASH_IMAGE_CODE

e.g. λ node index VKkMXGp_bq0

default expected output should be similar to this

ES7UZqHJ8NPOVYNdR5rwQjwxRtcq_xVzmoIeeCOq9fA https://images.unsplash.com/photo-1626999999946-bcd946d08030?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=MnwyNDIzMjB8MHwxfGFsbHx8fHx8fHx8fDE2MjYwNDM4NTU&ixlib=rb-1.2.1&q=80&w=1080 Nyhavn buildings in Copenhagen https://unsplash.com/photos/VKkMXGp_bq0 Mihai Moisa

unsplash-single-image's People

Contributors

jlancelot2007 avatar

Watchers

 avatar  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.