Multi files uploader & image resizer

Overview

Multi files uploader & image resizer

A PHP base class that you can use to upload any file into the server. It is a very lightweight class and highly customizable. You can use this class with any framework or with core PHP.

Dependencies:

This class is based on the GD library for image processing. If you don’t have this library install it or enable it in php.ini. To install the GD library use the below command.

sudo apt-get install php-gd

After installation makes sure you have a gd.ini file then open the php.ini file and find it below.

;extension=gd

Remove the comment [ ; ] and change it to below.

extension=gd

Composer installation:

composer require learncodeweb/filesupload

After installation recreates the autoload file with the help of the below command.

composer dump-autoload

How to import into the project:

In laravel 8/9 (Tested)

use anyFileUpload\FilesUploadAndImageResize as anyFilesUpload;

$files = new anyFilesUpload('array', ['jpg', 'jpeg', 'png'], public_path('uploads'), 0777);
$files->uploadFiles('files', 250, '', '', 100, '850', ['350']);

dd($files->uploadedData);

In core PHP just add the autoload.php file to your project like below.

required('.../vendor/autoload.php');
$upload    =    new anyFileUpload\ImageUploadAndResize('array', ['jpeg', 'jpg', 'png'], '../uploads', 0655);
$upload->uploadFiles('files', 250, '', $rename, 100, '850', ['350','450']);

Class option & features:

A PHP base class that you can use to upload any file into the server. It is a very lightweight class and highly customizable. You can use this class with any framework or with core PHP.

  1. Upload Single Or Multiple Files.
  2. Upload Any Type Of Files (Not Only Images).
  3. The image file can Resize.
  4. Create Image Thumbnails (With Keep The Image Aspect Ratio).
  5. You can add a watermark (Text, Image).
  6. Easy Integration With Forms.
  7. Create Any Number Of Thumbnails Under One Upload.
  8. Customizable Paths To Thumbnails Folders.
  9. Customizable Thumbnails Sizes And Dimensions.
  10. Files Extension Filters.
  11. File Size Limit for Uploading.

All parameters that you need to set in the constructor

Parameters Default Value Description
Response format array You can set it to JSON or array.
Allow extensions Not set You can set the file extensions in the array like ['jpg','PNG'].
Dir path empty Folder name where you need to save images [‘../Upload/’]. If you set the thumbs size array, the thumb folder will be created and thumb files move there.
Dir permission 0655 You can set the permission of the newly created Dir.

All parameters that you need to set in the method

Parameters Default Value Description
Input index name User set You can set your input="file" name should be an array like name="yourIndexName[]".
Check minimum with 400 Default min with is 400, you can change with any number.
Watermark empty You can set the watermark array to see the below details.
Re-name empty Rename the uploaded file if you need it. Left empty get system created default name.
Image Quality 100 Image quality in percent 1-100. Apply only for images (jpg,jpeg,png,gif).
New Width empty If you want to resize the image then pass int value else upload without resizing the image will be saved.
Thumb Widths empty If you want to create multiple thumbs then pass int value with array [350,450].

How to use with direct access:

require('../FilesUploadAndImageResize.php'); // File direct access
$rename    =    rand(1000, 5000) . time(); // left empty if you want the real file name
$upload    =    new anyFileUpload\ImageUploadAndResize('array', ['jpeg', 'jpg', 'png'], '../uploads', 0655);
$upload->uploadFiles('files', 250, '', $rename, 100, '850', ['350','450']);

For watermark you will use an array and be able to add the image as a watermark or text.

With text below will be the parameters:

50, 'font-family' => "../fonts/Myriad-Pro-Regular.ttf", 'font-color' => '#0a103e', 'position-x' => 400, 'position-y' => 100 ];">
[
    'value' => "HI I AM ZAID",
    'font-size' => 50,
    'font-family' => "../fonts/Myriad-Pro-Regular.ttf",
    'font-color' => '#0a103e',
    'position-x' => 400,
    'position-y' => 100
];

With the image below will be the parameters:

400, 'position-y' => 100 ];">
[
    'value' => "your-image-complete-path",
    'position-x' => 400,
    'position-y' => 100
];

The response will get like the below:

In the below response, you will get the uploaded/not uploaded/bad extensions and success/error flags array or JSON data.

"; print_r($upload->uploadedData); print "";">
print "
";
print_r($upload->uploadedData);
print "
"
;

Upload file size change on the server

There is a possibility the upload file size is not set on a server, the default 2MB value is set on a server. If you face this type of issue just find the right path of your php.ini file and change the bleow two parameters.

upload_max_filesize = 2M
post_max_size = 8M

Change to below.

upload_max_filesize = 100M
post_max_size = 150M

Remember:

post max size should be greater than upload max filesize.

Donate with love Donate with love
You might also like...
The Asset component manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files.

Asset Component The Asset component manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files. Res

The project provides a docker image for Files App(files.photo.gallery).
The project provides a docker image for Files App(files.photo.gallery).

For the purpose of learning,I replace the files.js with cracked version which just remove authorization code.

A Sharex IMG uploader that runs with PHP | Use a hosting site if you're a beginner use 000webhost
A Sharex IMG uploader that runs with PHP | Use a hosting site if you're a beginner use 000webhost

Sharex-Img-Uploader A Sharex IMG uploader that runs with PHP | Use a hosting site if you're a beginner use 000webhost Setting up SXCU In YOUR_DOMAIN_U

A php sharex uploader with discord embed function/twitter card support

Sharex Uploader Simple Sharex Uploader with Discord embed function Download replace your data and upload to your sevrer

Creating a file uploader with Laravel
Creating a file uploader with Laravel

File-Uploader File uploader is a simple group of restful APIs built in Laravel to upload file into a server and remove the file from that server. Tool

Laravel Model File Uploader package

Laravel Model File Uploader package Easy way to upload laravel model related file from the requset. Install (Via Composer) composer require plusemon/u

FIle Uploader is a php package to aid fast , easy and safe file upload

FILE UPLOADER FIle Uploader is a php package to aid fast , easy and safe file upload installation composer require codad5/file-helper Features Fast an

Run multiple websites using the same Laravel installation while keeping tenant specific data separated for fully independent multi-domain setups, previously github.com/hyn/multi-tenant

The unobtrusive Laravel package that makes your app multi tenant. Serving multiple websites, each with one or more hostnames from the same codebase. B

MajorDoMo is an open-source DIY smarthome automation platform aimed to be used in multi-protocol and multi-services environment.
MajorDoMo is an open-source DIY smarthome automation platform aimed to be used in multi-protocol and multi-services environment.

MajorDoMo (Major Domestic Module) is an open-source DIY smarthome automation platform aimed to be used in multi-protocol and multi-services environment. It is based on web-technologies stack and ready to be delivered to any modern device. It is very flexible in configuration with OOP paradigm used to set up automation rules and scripts. This platform can be installed on almost any personal computer running Windows or Linux OS.

Full-featured e-commerce platform with multi-domain and multi-language support for PHP 8

Surikata.io Full-featured e-commerce platform with multi-domain and multi-language support for PHP 8. Free to use for both commercial and personal pro

Taskpm - Run multi tasks by PHP multi process

php-pkg-template Run multi tasks by PHP multi process Install composer composer require phppkg/taskpm Usage github: use the template for quick create

 Plug & Play [CURL + Composer Optional], Proxy as a Service, Multi-tenant, Multi-Threaded, with Cache & Article Spinner
Plug & Play [CURL + Composer Optional], Proxy as a Service, Multi-tenant, Multi-Threaded, with Cache & Article Spinner

🦄 .yxorP The SAAS(y), Multitenancy & Augmenting Web Proxy Guzzler is a 100% SAAS(y) plug-and-play (PHP CURL+Composer are Optional) solution that leverages SAAS architecture to provide multi-tenancy, multiple threads, caching, and an article spinner service.

Talkino allows you to integrate multi social messengers and contact into your website and enable your users to contact you using multi social messengers' accounts.

Talkino Welcome to our GitHub Repository Talkino is a click to chat plugin to show your agents’ multiple social messengers, phone and emails on the ch

Auto Image & file upload, resize and crop for Laravel eloquent model using Intervention image

Laravel ImageUp The qcod/laravel-imageup is a trait which gives you auto upload, resize and crop for image feature with tons of customization. Install

A Laravel Gravatar package for retrieving gravatar image URLs or checking the existance of an image.

Gravatar for Laravel 5.x, 6, 7 and 8 Installation First, pull in the package through Composer via the command line: composer require creativeorange/gr

This plugin adds a new image style for the Core Image block.
This plugin adds a new image style for the Core Image block.

This plugin adds a new image style for the Core Image block. Introduction How to use? Go to Gutenberg Editor and add a image block. e.g. Add new image

WordPress plugin renames image filenames to be more SEO friendly, based on the post's data and image metadata.

=== Automatic image Rename === Contributors: wpsunshine Tags: image, images, SEO, rename, optimization Requires at least: 5.0 Tested up to: 6.2.2 Stab

Allows generate class files parse from json and map json to php object, including multi-level and complex objects;

nixihz/php-object Allows generate class files parse from json and map json to php object, including multi-level and complex objects; Installation You

Image optimization / compression library. This library is able to optimize png, jpg and gif files in very easy and handy way. It uses optipng, pngquant, pngcrush, pngout, gifsicle, jpegoptim and jpegtran tools.

Image Optimizer This library is handy and very easy to use optimizer for image files. It uses optipng, pngquant, jpegoptim, svgo and few more librarie

Releases(any-file-upload)
  • any-file-upload(Apr 21, 2022)

    A very simple (GD library Image processing) class for uploading multiple files. You can create multiple thumbnails, add a watermark (text/image), resize, and change the quality of the images. You can also use this class with any PHP framework, tested with Laravel 8 and Laravel 9.

    Source code(tar.gz)
    Source code(zip)
Owner
LCW
Solution Providers
LCW
TinyFileManager is web based file manager and it is a simple, fast and small file manager with a single file, multi-language ready web application

TinyFileManager is web based file manager and it is a simple, fast and small file manager with a single file, multi-language ready web application for storing, uploading, editing and managing files and folders online via web browser. The Application runs on PHP 5.5+, It allows the creation of multiple users and each user can have its own directory and a build-in support for managing text files with cloud9 IDE and it supports syntax highlighting for over 150+ languages and over 35+ themes.

Prasath Mani 3.5k Jan 7, 2023
A Multi-Framework Composer Library Installer

A Multi-Framework Composer Library Installer This is for PHP package authors to require in their composer.json. It will install their package to the c

Composer 1.4k Jan 3, 2023
Elastic Beanstalk Multi Container PHP-FPM + Nginx Demo App

Elastic Beanstalk Multi Container PHP-FPM + Nginx Demo App This demo app shows you how to run a simple PHP application using the PHP-FPM and Nginx Doc

AWS Samples 141 Sep 18, 2022
Infopanel is a simple tool getting some information from source. It works basically like a slider that shows only title, image, a little bit description and QR-Code for links.

Infopanel is a simple tool getting some information from source. It works basically like a slider that shows only title, image, a little bit description and QR-Code for links. It has its own GUI for the editing. The GUI provides a very simple role concept. This tool can be used for digital signage, Information panels, News or Events or similar.

null 4 Aug 22, 2022
A little PHP script created for uploading custom sharex files to your own webserver

ShareX-Custom-Upload A little PHP script created for uploading text, files, and images to your own webserver. It supports uploading via ShareX, but al

Joe Gandy 161 Dec 13, 2022
Simple-podcast-generator - 👉 A very simple way to host your podcast files and generate the RSS Podcast feed 🎙

Podcast RSS Feed Generator A very simple way to host your podcast files and generate the RSS Podcast feed ?? ?? Contents Summary Requirements Installa

♚ PH⑦ de Soria™♛ 11 Dec 2, 2022
Free image uploader - powered by ShareX

Reactor Free image uploader - powered by ShareX. Feel free to re-use ! NO Support Installation Upload the files on your webhost. Create a folder named

CODEMAFiA 1 Apr 5, 2022
Image Cache is a very simple PHP class that accepts an image source and will compress and cache the file, move it to a new directory, and returns the new source for the image.

NO LONGER MAINTAINED!!! Image Cache v. 1.0.0 Image Cache is a very simple PHP class that accepts an image source and will compress and cache the file,

Erik Nielsen 455 Dec 30, 2022
Uploader is a set of small classes for sending images, files, and media received by a form of your application

Uploader is a set of small classes for sending images, files, and media received by a form of your application. The Uploader handles, validates and sends the files to your server. Image class can still handle sizes with the gd library.

null 5 Dec 22, 2022
A Laravel package that allows you to use multiple ".env" files in a precedent manner. Use ".env" files per domain (multi-tentant)!

Laravel Multi ENVs Use multiple .envs files and have a chain of precedence for the environment variables in these different .envs files. Use the .env

Allyson Silva 48 Dec 29, 2022