Code Monkey home page Code Monkey logo

strapi-provider-upload-matrix's Introduction

Strapi Matrix Provider

Combine multiple upload plugins together.

๐Ÿ•น f3l1x.io | ๐Ÿ’ป f3l1x | ๐Ÿฆ @xf3l1x


Usage

To install latest version use NPM.

npm install --save strapi-provider-upload-matrix

Overview

Strapi has great support for plugins and upload providers, but you can register only one upload provider. Let's say you want to deploy images to image service and other files to file service. This provider will help you.

Documentation

  1. Install provider.

  2. Install other upload providers.

  3. Edit configuration.

    We are going to setup 2 providers (ImageKit and S3).

    • Images will use imagekit according to extensions (png, jpg, jpeg, svg, webp, gif, tif, mp4, webm, mov, swf, pdf)
    • Other files will use aws-s3 according to fallback

    {strapi}/config/plugins.js

    module.exports = ({ env }) => ({
        upload: {
            provider: 'matrix',
            providerOptions: {
            resolvers: [
                // ImageKit
                // Images, videos
                {
                    id: 'images',
                    test: {
                        ext: ['png', 'jpg', 'jpeg', 'svg', 'webp', 'gif', 'tif', 'mp4', 'webm', 'mov', 'swf', 'pdf'],
                    },
                    use: {
                        provider: "imagekit",
                        providerOptions: {
                        publicKey: env("IMAGEKIT_PUBLIC_KEY"),
                        privateKey: env("IMAGEKIT_PRIVATE_KEY"),
                        urlEndpoint: env("IMAGEKIT_URL"),
                            params: {
                                folder: env("IMAGEKIT_FOLDER"),
                            }
                        }
                    }
                },
                // AWS S3
                // Fallback
                {
                    id: 'misc',
                    test: '*',
                    use: {
                        provider: 'aws-s3',
                        providerOptions: {
                        accessKeyId: env('AWS_ACCESS_KEY_ID'),
                        secretAccessKey: env('AWS_ACCESS_SECRET'),
                        region: env('AWS_REGION'),
                            params: {
                                Bucket: env('AWS_BUCKET'),
                            },
                        }
                    },
                },
            ]
            },
        }
    });
  4. Profit ๐Ÿš€

Development


Consider to support f3l1x. Also thank you for using this package.

strapi-provider-upload-matrix's People

Contributors

f3l1x avatar

Stargazers

 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.