GithubHelp home page GithubHelp logo

muhammadsaim / multiple-image-upload-php Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 8 KB

This is a multiple image upload with image resize

PHP 100.00%
php multiple-image multiple-image-upload multiple-image-upload-php upload images

multiple-image-upload-php's Introduction

Multiple Image Upload with PHP

Simple and reliable multi image uploader with PHP

Dependencies

Configurations

$ composer install

Customize image size in config.php and or remove or edit the size here size should be in pixels.

// sizes
$sizes = [
    "100x100" => [
        "width" => 100,
        "height" => 100,
    ],
    "150x150" => [
        "width" => 150,
        "height" => 150
    ],
    "250x250" => [
        "width" => 250,
        "height" => 250
    ]
];

All the images should be stored in upload/images you can change this path from config.php. Current file name will be like

0d6663aa77d719954285d73d37f1c0e0_1590698324_x_100_100.jpg

You can also change this in config.php.

After that you have array like this you can do whatever you want store it in database with JSON String.

array(5) {
  [0]=>
  array(3) {
    ["100x100"]=>
    string(55) "f5a78db13c51db68f5e64da442ee7234_1590722639_100x100.jpg"
    ["150x150"]=>
    string(55) "388b133b6ae46e858e25ff807fa059e6_1590722640_150x150.jpg"
    ["250x250"]=>
    string(55) "09ea1849e01fd9c64f71e36a4a6b2558_1590722640_250x250.jpg"
  }
  [1]=>
  array(3) {
    ["100x100"]=>
    string(55) "444afb279dba599f86d74d42df3c1efb_1590722640_100x100.jpg"
    ["150x150"]=>
    string(55) "8b710485501b37f73827caf510ae55cf_1590722640_150x150.jpg"
    ["250x250"]=>
    string(55) "323539daadfbb62404397c9f3a32b008_1590722640_250x250.jpg"
  }
  [2]=>
  array(3) {
    ["100x100"]=>
    string(55) "a6794989079587708f78db4f6538a9f6_1590722640_100x100.jpg"
    ["150x150"]=>
    string(55) "3ebec7afb567ca9d301cccacd8a9020e_1590722640_150x150.jpg"
    ["250x250"]=>
    string(55) "e6e80d0af359371dc034e79052301982_1590722640_250x250.jpg"
  }
  [3]=>
  array(3) {
    ["100x100"]=>
    string(55) "b76de744195c57f4d6cf773349959f1d_1590722640_100x100.jpg"
    ["150x150"]=>
    string(55) "fc21c7950b78f5e8d0e1a7a6ed7b85b9_1590722640_150x150.jpg"
    ["250x250"]=>
    string(55) "06f42563453b752eb7faeb16ff2f0ae2_1590722640_250x250.jpg"
  }
  [4]=>
  array(3) {
    ["100x100"]=>
    string(55) "d42345551c4f97687c8013c4e0f8fb82_1590722640_100x100.jpg"
    ["150x150"]=>
    string(55) "70f13f94af8cd4b2f4d473f964cf1b25_1590722640_150x150.jpg"
    ["250x250"]=>
    string(55) "4203400ad20152785e7c294cd5d08cbf_1590722640_250x250.jpg"
  }
}

After Converted this array into JSON you have JSON string like that.

[
   {
      "100x100":"f5a78db13c51db68f5e64da442ee7234_1590722639_100x100.jpg",
      "150x150":"388b133b6ae46e858e25ff807fa059e6_1590722640_150x150.jpg",
      "250x250":"09ea1849e01fd9c64f71e36a4a6b2558_1590722640_250x250.jpg"
   },
   {
      "100x100":"444afb279dba599f86d74d42df3c1efb_1590722640_100x100.jpg",
      "150x150":"8b710485501b37f73827caf510ae55cf_1590722640_150x150.jpg",
      "250x250":"323539daadfbb62404397c9f3a32b008_1590722640_250x250.jpg"
   },
   {
      "100x100":"a6794989079587708f78db4f6538a9f6_1590722640_100x100.jpg",
      "150x150":"3ebec7afb567ca9d301cccacd8a9020e_1590722640_150x150.jpg",
      "250x250":"e6e80d0af359371dc034e79052301982_1590722640_250x250.jpg"
   },
   {
      "100x100":"b76de744195c57f4d6cf773349959f1d_1590722640_100x100.jpg",
      "150x150":"fc21c7950b78f5e8d0e1a7a6ed7b85b9_1590722640_150x150.jpg",
      "250x250":"06f42563453b752eb7faeb16ff2f0ae2_1590722640_250x250.jpg"
   },
   {
      "100x100":"d42345551c4f97687c8013c4e0f8fb82_1590722640_100x100.jpg",
      "150x150":"70f13f94af8cd4b2f4d473f964cf1b25_1590722640_150x150.jpg",
      "250x250":"4203400ad20152785e7c294cd5d08cbf_1590722640_250x250.jpg"
   }
]

multiple-image-upload-php's People

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.