Coder Social home page Coder Social logo

pierreamgabriel / react-images-upload Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 2.99 MB

React component to upload images.

License: GNU General Public License v3.0

CSS 6.02% JavaScript 60.02% PHP 33.96%
image-upload react reactjs react-images-uploading uploader

react-images-upload's Introduction

React Images Upload

This is a React component to upload images. It's easy to use, and it comes with a PHP script to handle the back-end logic.

Installation

Copy the lib folder and the ImageUpload.js and ImageUpload.css files to the src folder of your project. Copy the upload.php file to the public folder. Create a folder called uploads inside the public folder.

Install dependencies:

npm install axios @mui/material @emotion/react @emotion/styled

Usage

Import the component in your code:

import ImageUpload from './ImageUpload';

How does it work?

It copies any jpg or png image to the uploads folder, and it adds the image URL to the imgList variable in the order it was uploaded. It also shows a preview of all images uploaded with an edit and delete button.

What do I do with the URL list in the imgList variable?

You save the URLs in your database. You'll need to change the code a bit to add your logic.

How can I apply different styles?

You can freely change the code and apply the styles you want.

Does it delete and replace images as well?

It does, but it won't delete the actual images inside the uploads folder. It'll just update the URL list.

How can I upload images to a different folder?

You need to change the upload.php file.

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.