Git Product home page Git Product logo

lprivo / directus-image-scout Goto Github PK

View Code? Open in Web Editor NEW

This project forked from resauce-dev/directus-image-scout

0.0 0.0 0.0 617 KB

Find yourself browsing image libraries to visually enhance your project? — Image Scout extends Directus allowing you to easily search through a range of online image sources for the image that suits you! Providers include Pexels, Pixabay, Unsplash & Giphy! ( - Vue 3 Supported - )

License: GNU General Public License v3.0

JavaScript 55.37% TypeScript 1.33% Vue 43.30%

directus-image-scout's Introduction

Image Scout

v3.0.0 Tested On Directus 9.18.1

What is Image Scout?

Image Scout is an interface extension for Directus 9 developed by Resauce. A clean interface is provided allowing you to search multiple online image libraries to find images that suit your needs. When a provider is configured, the connection should be seamless, allowing you to easily find and use the image that you want or need in your project.

Here's what image-scout looks like!

Picture of the interface

Install & Get Started

Copy the folders from this repository's dist directory into your extensions folder

  • `/extensions/interfaces/resauce-image-scout
  • `/extensions/endpoints/resauce-image-scout

To enable providers for your users to use:

  • Decide what providers you want to use and register for an API Key
  • Configure the below providers as required
  • Restart your Directus instance
  • The configured providers will now be available on the frontend

Envrionment Variables

Env Example Default Value Security URL Description
API_KEY_UNSPLASH NULL https://images.unsplash.com The key you configured to use the Unsplash API
API_KEY_PEXELS NULL https://images.pexels.com The key you configured to use the Pexels API
API_KEY_PIXABAY NULL https://pixabay.com The key you configured to use the Pixabay API
API_KEY_GIPHY NULL https://*.giphy.com The key you configured to use the Giphy API
RIS_DEFAULT_PROVIDER NULL - The key of the provider you would like as your default selection
RIS_REQUIRED_AUTH TRUE - Is direcus authentication required to use this API externally?

Configuring URLs

Due to the Content-Security-Policy that Directus uses through the Helmet system, you will need to whitelist the URLs that the images will come from.

This means you will need to add the below configuration to your environment file, you can omit any URLs that you don't have configured.

CONTENT_SECURITY_POLICY_DIRECTIVES__IMG_SRC="'self' data: blob: https://cdn.directus.io https://images.unsplash.com https://images.pexels.com https://pixabay.com https://*.giphy.com"

Interface Usage & Collection Usage

To enable Image Scout as field in your application, follow this basic guide:

  1. Edit collection where you would like to enable Image Scout
  2. Click "Create Field"
  3. Under the relational section, create a new field for: Image Scout (Last option)
  4. Enter the key (eg: promo_image) and decide if it's required or not.
  5. Save & Go to your collection to use Image Scout

Learn More — What's a provider?

A provider is an online service that allows you to view and download images for use in your own project. The providers we have are listed below, to enable them, you must register an API key with the service then store that key in your Envrionment File.

If you have multiple providers enabled, you can decide which provider you would like to be the default provider by setting the RIS_DEFAULT_PROVIDER in your envrionemnt file

Pixabay

Provider Key: PIXABAY

Directus ENV Configuration Key: API_KEY_PIXABAY

API Registration: https://pixabay.com/api/docs/

Unsplash

Provider Key: UNSPLASH

Directus ENV Configuration Key: API_KEY_UNSPLASH

API Registration: https://unsplash.com/developers

Giphy

Provider Key: GIPHY

Directus ENV Configuration Key: API_KEY_GIPHY

API Registration: https://developers.giphy.com/docs/api/

Pexels

Provider Key: PEXELS

Directus ENV Configuration Key: API_KEY_PEXELS

API Registration: https://www.pexels.com/api/

Note: An approved account will be required to be able to download high-res images. Please have your account approved otherwise you may not be able to download images.

Common Issues

I've come across a few issues, here's the issues and how to fix them.

🎨 Failed to import image

This error usually comes along with ECONNREFUSED and a 500 status request to /resauce-image-scout/providers/<provider>/download

This happens when you are loading the app from a different URL to the one configured in your HOST entry in your .env file

Refused to load the image '' because it violates the following Content Security Policy directive

This occurs when you've failed to configure the URL in the CONTENT_SECURITY_POLICY_DIRECTIVES__IMG_SRC variable required further up the documentation.

Liability

Before activating any provider, ensure you have agreed to their terms and usage policy. You are subject to their usage terms based on how you use these images. No contributor to this repository accepts responsibility for the use of the images.

directus-image-scout's People

Contributors

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