Multiple Image Upload and Generate Thumbnails in PHP

Hi guys, in this post we will see how to upload multiple images and generate thumbnails of uploaded images on the fly and also save image name/path to database. We have used image magician library to generate thumbnails, it’s really great and easy to use. You can check their official site here. This script would be useful if you have many large images in your site and you only want to display thumbnails in index pages to reduce page size. Then clicking on thumbnails would open respective larger images, it’s just an example, you can utilize this script in multiple ways.

upload multiple image


Let’s see how it all works. So as usual we have connection.php file to connect with database and index.php file that displays the upload form in frontend and calls upload.php file which uploads the file to server and with the help of image magician library it generates thumbnails of uploaded image and saves them in a different directory.

Below is our code for index.php:


Once you hit upload, upload.php file would come into action and will upload these selected files to server and will resize them. You can find the SQL script in zip file that you can download from above download link. Hope this simple upload script would come handy in your web projects.


About sanjeev

Dreamer, Blogger and Thinker. I love to help people in solving their problems. You can also join me HERE

Related posts:

Leave a Reply

Your email address will not be published. Required fields are marked *