npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@davepwsmith/gatsby-source-flickr

v2.0.4

Published

A source plugin to retrieve photos from flickr

Downloads

13

Readme

gatsby-source-flickr

This source plugin for Gatsby will make images from Flickr available in GraphQL queries.

Installation

# Install the plugin
npm install @davepwsmith/gatsby-source-flickr

In gatsby-config.js:

module.exports = {
  plugins: [
    {
      resolve: "@davepwsmith/gatsby-source-flickr",
      options: {
        api_key: "YOUR_FLICKR_API_KEY",
        username: "YOUR_FLICKR_USERNAME",
      },
    },
  ],
};

It is recommended to store the API key and Username as environment variables, so that they are not exposed in the app.

NOTE: To get a Flickr API key, register for a Flickr account. You will then need to create a Flickr API app.

Configuration Options

The plugin uses the people.getPublicPhotos endpoint, and will add sane, restrained defaults.

The api_key and username options are required.

In order to retrieve less information where possible, the plugin allows you to specify extras as per the Flickr API call options If you want to add any other "extras" to this from the API above, you can include them in an array on the extras key (example below). N.B.: There is no need to include photo urls or dimensions as extras, as these are already included by default.

Example Configuration

This would retrieve all photos for a given user id, and include location data.

module.exports = {
  plugins: [
    {
      resolve: "@davepwsmith/gatsby-source-flickr",
      options: {
        api_key: process.env.FLICKR_API_KEY,
        username: process.env.FLICKR_USER,
        extras: ["description", "geoData"],
      },
    },
  ],
};

Querying Flickr Images

Once the plugin is configured, two new queries are available in GraphQL: allFlickrPhoto and flickrPhoto.

The nodes will have the following fields by default:

_id owner title images thumbnails

Any extras will add further nodes specific to those extras.

Images can be accessed using much of the standard gatsbyImageData API which gatsby-plugin-image provides. An example below shows how you could fetch an image in square format by specifying height and width. Check out the gatsby-plugin-image documentation for more information on available parameters.

query PhotoQuery {
  allFlickrPhoto(limit: 10) {
   nodes {
        id
        title
        description
        gatsbyImageData(
          width: 300,
          height: 300
        )
        
      }
    }
  }