Upload multiple images create thumbnails and save path to database with php and mysql

by  
Share:
Upload multiple images create thumbnails and save path to database with php and mysql

One of my blog follower Vikash Singh from West Bengal, requested me to provide some codes so that he can upload multiple images create thumbnails and save path to database with php and mysql. I could have directly sent him the codes but I am posting in my blog so that someone with similar problem could benefit from his request.

Scope of this script

I have posted similar topics before, check Upload multiple files with php, Upload and save image with PHP and MySql, Generating thumbnails on the fly. But in this case there’s a slight catch. When you upload multiple images, a thumbnail will be generated accordingly and its path will be stored in mysql database. So if you upload 4 images then total 8 images are stored.

Setup a form to upload multiple images

First of all you need to setup your form with file fields so you can attach multiple images. Here’s the first approach where you can attach multiple images using one file field. Make sure the name ends with [] and multiple=”multiple” attribute must be present.

<form name="f" action="index.php" method="post" enctype="multipart/form-data">
<!-- name must end with [] and multiple="multiple" must be presest -->
<input class="files" name="user_files[]" type="file" multiple="multiple" >
<input type="submit" name="sub1" value="Upload Images" />
</form>

The other approach is by using jquery where you can create multiple file fields. I have already posted an article Add remove multiple textfield with jquery. Just replace the textfield with file field. Also make sure you give [] with every name. [] denotes array.

Steps to upload multiple images with php

After you setup the form, it’s time to upload images. Uploading multiple images involves these steps:

Check if images are attached for uploading. There’s no point of going further if you haven’t attached any image to upload.

<?php
if (count($_FILES["user_files"]) > 0) {
  // images are attached to upload
} else {
  // no images are attached
}

If you have attached images for uploading, the first priority is to check if its a valid image or not.
<?php
// only for gif, jpeg, jpg, bmp, png images
$valid_image_check = array("image/gif", "image/jpeg", "image/jpg", "image/png", "image/bmp");

// loop through the file fields
for ($i = 0; $i < count($_FILES["user_files"]["name"]); $i++) {
// get the image mime type
  $image_mime = strtolower(image_type_to_mime_type(exif_imagetype($_FILES["user_files"]["tmp_name"][$i])));

  if (in_array($image_mime, $valid_image_check)) {
    // Proper image file, you can upload
  } else {
    // Not a valid image, do not upload
  }

}

?>

If the image file has passed the mime test, you can upload the image. Always generate a unique name to avoid overwriting any existing images on the server.
<?php
$folderName = "uploads/";
$ext = explode("/", strtolower($image_mime));
$ext = strtolower(end($ext));
$filename = rand(10000, 990000) . '_' . time() . '.' . $ext;
// if user upload a file abc,jpg, it will convert it to 291905_1399918178.jpg based on random number and time.
$filepath = $folderName . $filename;

if (!move_uploaded_file($_FILES["user_files"]["tmp_name"][$i], $filepath)) {
  // Failed to upload image, do not create thumbnail and dont save in database
} else {
  // Uploaded Successfully, now create thumbnail and save in database.
}
?>

Steps to create thumbnails with PHP Image Magician

Why re-invent the tool if you already have them. PHP Image Magician is a very nice library to manipulate images. It’s features not only limit to creating thumnails, you can perform many amazing task like add text, resize,crop,sharpen, give color, save to transparent images and many more. Check the official site for more details.

Moving futher, you have to create a folder name “uploads” to save the main/larger images and inside uploads folder create “thumb” folder which will save the thumbnail of that image. The trick is that the thumnail version of the image will have the same name as the main/larger image just seperated by the directory name.

uploads (folder)
--abc.jpg
--xyz.jpg
--thumb (folder containing thumbnails)
   --abc.jpg
   --xyz.jpg

Coming back to our code, If the image is successfully uploaded you will then create a thumbnail of that image and store it in thumb folder.
// include library class
require_once('./php-image-magician/php_image_magician.php');

$magicianObj = new imageLib($filepath);
// will create a 100 X 100 image, check documentation for more parameters
$magicianObj->resizeImage(100, 100);
// saving file to thumb directory
$magicianObj->saveImage($folderName . 'thumb/' . $filename, 100);

Now the last part of this section is to insert the filename in mysql database. I have used PDO class. If you are still using old mysql_query it’s time to upgrade it. I have made a mini project Simple address book with php and mysql using pdo that will help you get started.
CREATE DATABASE image_test;
USE image_test;
CREATE TABLE IF NOT EXISTS `tbl_images` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `image_name` varchar(255) NOT NULL,
  `created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

<?php
$sql = "INSERT INTO tbl_images(image_name) VALUES (:img)";
$stmt = $DB->prepare($sql);

try {
  $stmt->bindValue(":img", $filename);
  $stmt->execute();
  $result = $stmt->rowCount();
  if ($result > 0) {
    // file uplaoded successfully.
  } else {
  // failed to insert into database.
  }
} catch (Exception $ex) {
  $emsg .= "<strong>" . $ex->getMessage() . "</strong>. <br>";
}
?>

Display uploaded image with thumbnails

The most easiest part of all these section is fetching the records from the database and display both large and thumbnail image.

<?php
// fetch all records
$sql = "SELECT * FROM tbl_images WHERE 1 ";
try {
  $stmt = $DB->prepare($sql);
  $stmt->execute();
  $images = $stmt->fetchAll();
} catch (Exception $ex) {
  echo $ex->getMessage();
}
// display both images
foreach ($images as $img) {
?>
<div><img src="uploads/thumb/<?php echo $img["image_name"]; ?>" alt="<?php echo $img["image_name"]; ?>"></div>
<div><img src="uploads/<?php echo $img["image_name"]; ?>" alt="<?php echo $img["image_name"]; ?>"></div>
<?php
}
?>

Download the source code below and run on your server. Hope this code helps you.
Download

Get the latest updates directly in your inbox for FREE: Subscribe here

Share your feedback / let me know your doubts regarding this tutorial in the comment box given below.

Share:
Hasan

Shahrukh Khan (Hasan)

A software engineer who's a die-hard coder, blogger, dreamer and mentor with years of expertise in web development. Know more...

Related Posts

Krishna Chaitanya Kollu on

Thank you Sir for your coding

Reply
vikash singh on

thanks brother

Reply
pistachio on

hello, thanks for your code, but im getting error Call to undefined function exif_imagetype() in F:wampwwwsaveindex.php on line 48

is there any solution?

Reply
pistachio on

No need bro.. I found that i have to enable below in php.ini

extension=php_mbstring.dll

extension=php_exif.dll

Reply
Shahrukh Khan on

great work.. hope this script helps you

Florian Schubert on

hey…
I want to save each img file … in a different column…
img_v1, img_v2, img_v3 and so on…

how do I get the filename ?

if I do that…

$imgv1 = $_FILES[“user_files”][“tmp_name”][0];
$imgv2 = $_FILES[“user_files”][“tmp_name”][1];

the unique name wouldn’t be saved in the column, just the original name…

please help me

Reply
Shahrukh Khan on

hi.
well in that case you count the no of columns you have say 5.. and when u loop the images keep a counter and save the images accordingly…

Reply
Florian Schubert on

can u give me an example please… I really don’t know what u mean :O

Shahrukh Khan on

Please mail me this question in my request a tutorial section with this topic. I will try to send you the working code

Ankita on

Hi,even i have the same query to store image path in different column please can you provide the code.

Shahrukh Khan on

you need to make sure how many columns you have in your DB and how many fields you are giving in the form. set the index of every one of the field and based upon that update that in your column. rest of the codes are same.

pistachio on

hi, is that possible to change the size of original uploaded image? I
mean suppose i upload 2 mb and 4000×3000 pixels size , so this script
will create 100×100 px thumb and move to thumb folder and original big
image to main image upload folder. my question is can we resize the
original image also, say 800×600 and thumb of 100×100?

Reply
Shahrukh Khan on

Yes you can using phpimagemagician library that I have used in this script

// include library class
require_once(‘./php-image-magician/php_image_magician.php’);

$magicianObj = new imageLib($filepath);
// will create a 100 X 100 image, put your dimension here
$magicianObj->resizeImage(100, 100);

// saving file to thumb directory
$magicianObj->saveImage($folderName . ‘thumb/’ . $filename, 100);

Reply
Akhil P Ashok on

i want to upload images through different fields.. like 1-logo 2-image1 3-image2 4-image3.
how can i do that???

Reply
Alex on

Hi, Very nice tutorial but I tried to upload the images, and then it returned this message:
Warning: move_uploaded_file(uploads/110310_1408656074.png): failed to open stream: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/photob/index.php on line 57

Do you know why?
Greetings!!
Alex

Reply
Shahrukh Khan on

Hi. this is a clear problem of the folder permission. make sure u have a uploads folder and it has 775 or 777 writable permission on it.

Reply
Alex on

Hi! Thank you for your replay! it has been very useful!
Now appears this message:
“The path is not writable. Please check your permissions”.
BUT, Anyway, It already moved the file to the folder I assigned,
thats good!,
but nothing appears inserted on my database yet.

Any suggestions?

Shahrukh Khan on

Now you need to feed the filename in database. check your SQL if the filename is proper or not. Make sure you have a sql query with filename.

Alex on

Ok, since I am a beginner, can you tell me how to check my SQL
on phpmyadmin and how to put the filename on the sql query?

Alex on

Hi, I did what you said, I feed the file name in database, and yes,
it appears the space for the thumbnail and the image, but they don´t show up, they show up like a question mark. How can I do to fix this?
Chao!!

Alex on

Ok, Also I fix this!!,
But Do I have to write the filename in the database always?
or is supposed to do it automatically?

Alex on

Also returned me this..
Warning: move_uploaded_file(): Unable to move ‘/Applications/XAMPP/xamppfiles/temp/phpgx7TMA’ to ‘uploads/110310_1408656074.png’ in /Applications/XAMPP/xamppfiles/htdocs/photob/index.php on line 57

Reply
deepak on

how to fetch images from database one by one In slider..

Reply
ahmed ja'far hasan on

good question boss same to me anyone??

Reply
giau nguyen thanh on

hi guys! i have to trouble hope guys help me. Thank you very much.

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Unknown: Failed opening required ‘C:/wamp/www/PHP/thủ thuật demo sÆ°u tầm/save_create_image_thumnail_php_mysql/index.php’ (include_path=’.;C:phppear’) in Unknown on line 0

Reply
sudeep on

Bro first create data base with give .. sql query with demo……. and then put all file in htdocs / root folder and
then in index.php change database credential in file .. thats it

then run .. it will run …. 100% sure… if its not working then reply…..

Reply
sudeep on

Thanks its good work and .. once again… thanks for code…. u save my time….. Thanks Alot

Reply
rimpy on

hi,i have a problem .the problem is that only one image is uploaded in database while coding is for multiple images.I cross checked the coding but invain

Reply
Shahrukh Khan on

I believe you have done some error in the code. It is working perfectly in the script.

Reply
vijay on

if i write $folderName = “uploads/***”; * some other folder then i am getting this the path is not writable. please check your permissions
please help me in this
thanks in advancd

Reply
Shahrukh Khan on

make sure your folder has permissin 777 or 755 for the current user.

Reply
vijay on

iam not able to upload multiple images grater than 4mb each

Reply
muhit on

Hey shahrukh, thanks for a great tutorial……i need your guide, suppose i want to resize the original image by getting its width and height ratio. if i have an image of 1020 * 768 then how we resize it to half or something.

Reply
Shahrukh Khan on

In that case you can use
[code]
// just give calculate the width and reduce it to half or
// whatever your want for
and set the value
$magicianObj->resizeImage($smallwidth);
[/code]

Reply
adedivi on

pls am trying to contact you with your request form but i s not going , pls can i get you email address.

Reply
KRISHNA TEJA on

Hi, bro this tutorial really helped me.
I’m a php and mysql learner, I searched for many queries through google and finally I found this tutorial.
I used this tutorial to display images in my site http://www.digitalcrew.esy.es.

Thanks sharukh…

Reply
Shahrukh Khan on

Thanks bro. It feels great that it helped.

Reply
shekhar on

i have been assigned a project of student information, where in, students is applying for certificate. he/she need to apply online by providing personal information plus marks scored in 10th ,12th and has to upload jpg file of 10th,12th, caste certificate, thumb impression. I need to store all information of student in one record including 4 images.. how do i do that. pls help me

Reply
Shahrukh Khan on

Hi shekhar. in your case all you have to do is create a form with all the required fields and do both client side ( javascript) and Server side ( PHP ) validation, on the submit event store all the values to the database. For images make sure you use 4 file field with different name. check if the image file field has been image attached (server side), if so do process the image and store in the server and use that filename and store it in database. I hope this will do.

Reply
Nag on

How to save each time uploaded bunch of photos in separate sub folder under uploads foldes

Reply
Shahrukh Khan on

I will suggest you not to do this, but if you want to make add another text field ( for folder name) in the form and when user submits the form then create a folder with that name and upload the images in that folder. Also make sure you give write permission to that folder.

Reply
Nag on

Can you please send me the code, actually am looking for upload each event photos in separate folder so that i can able to fetch particular event photos when user click on cover photo of that particular event, and can please suggest me how to make that DEMO 2 part to upload videos because i have 9 colleges and i want to upload photos and videos college wise with each event photos belongs particular college will be in different folder. Any help may appreciated.

Shahrukh Khan on

Uploading images and Video are very much the same, all you have to make sure is the file upload limit and validate the file type. Coming back to your problem the possible solution cab be like this, You give a textfield where user will create a folder ( same like facebook albums concepts ) after the folder is created, upload the files under that.

shivraj porob on

i have a similar prblm
wer wen a student regsters he uplds his certificates 2 d db and d uplded images shld be stored in folders and each folder should be wid the students name

plz can u send me the code??

Nag on

Can you please post the code, Thanks in advance.

Reply
Shahrukh Khan on

I will try to send the code, but as I am involved in some projects It may take some time. You can send me what you have tried and I will try to fix it.

Reply
Kapil Kumar on

facing problem in this code

Fatal error: Undefined class constant ‘MYSQL_ATTR_INIT_COMMAND’ in C:\wamp\www\New folder\save_create_image_thumnail_php_mysql (1)\index.php on line 23

Reply
Shahrukh Khan on

I think you need to your open php.ini and remove semicolon ;extension=php_pdo_mysql.dll to extension=php_pdo_mysql.dll
This will solve your issue.

Reply
Shahrukh Khan on

If You are using PHP >= 5.3.6, so add charset to dsn and don’t use PDO::MYSQL_ATTR_INIT_COMMAND. Further I think you can only execute 1 query with PDO::MYSQL_ATTR_INIT_COMMAND. That might be the problem. Also try mysql:host=localhost;dbname=php_orm_test;charset=utf8

Reply
Nag on

Can you please post mysqli Procedural or mysql Procedural code of your post (Upload multiple images create thumbnails and save path to database with php and mysql) instead of PDO. Any help may appreciated.

Reply
Shahrukh Khan on

PDO and mysqli are very much same. just check the manual you can do that yourself too. if you need any further help let me know.

Reply
Nag on

As you said i trayed Upload files by creating folder, but its not uploading photos to created folder instad it is uploading only a first image out of several images under uploads and displaying error “The path is not writable. Please check your permissions.” also its not creating tumbs under the created folder
please try to correct this problem and please check your mail i sent a code attachment, Thank you

Reply
Shahrukh Khan on

try to use php chmod function. It will solve the permission issue.

Reply
Nag on

While creating the folder am specifying (mkdir($dir, 0777)); its correct na ? Please once check the code that i sent you in mail. Thank you

Reply
Shahrukh Khan on

Try using this after you create the folder chmod($dir, 755);

Reply
sachin on

hi i am getting this error

Fatal error: Call to undefined function exif_imagetype() in C:\wamp\www\multiple-upload\index.php on line 48

Reply
Shahrukh Khan on

in your php.ini file remove the semicon or add this line
extension=php_mbstring.dll
extension=php_exif.dll

Don’t forget to restart your apache server after doing this change.

Reply
Evelina on

Great help! I have been struggling with combining all the functionalities that I need for weeks now. Thank you!

Reply
Shahrukh Khan on

Glad it helped you.

Reply
sanjay on

nice work

Reply
Shahrukh Khan on

Thanks

Reply
mavin on

hi please am trying to choose one of my uploaded images as profile picture using php …please how do i go about this….your help will really be appreciated

Reply
Shahrukh Khan on

just use the image name and path and set it in a database column. or you could just use the name of the uploaded image and set the folder path hardcode way.

Reply
siva on

Thank you for your script…
But, I am getting error like “Image not found.” when i uploading an image how to solve that.
When i using re-size script this error came. But without using this re-size script image successfully updated. How can i solve this problem. Thank you.

Reply
Shahrukh Khan on

Maybe your image path is broken, please check your image path.

Reply
Prakash on

Sir, i want upload image and viewing image to their profile, again they upload means it will delete and store a latest image. now i done the code for uploading and viewing on their profile. but i upload another time means it will store one more time and viewing another time, please send example code. my email id is prakash.deva20@gmail.com

Reply
Edward on

Sir I cant see the download link to this your tutorial ” Upload multiple images create thumbnails and save path to database with php and MySQL “

Reply
Shahrukh Khan on

please see the social link that is available for download at the end of the tutorial.

Reply
kumar on

i need multiple image upload concept of data base using same row…..

Reply
Valmiki Nayak on

Rather than reinvent the wheel, I thought I’d Google for a code that came near enough to what I wanted. First half hour I found a whole load of crap created by people with no idea how to code. And then, I found this one – it is perfect. Saved me a lot of time. Thanks buddy, you’re great!

Mmuuuaaahhhhhhhh

Reply
Shahrukh Khan on

Thanks for you love <3

Reply
Ray.W on

Dear Mr. Khan,
Very nice and detailed working script! Already learned a great deal about php and PDO sql in this single exercise! I am currently working on a similar project, and I want to know if you can give me some advice on it.

Firstly, in my server there will be an “original” folder, and inside that folder, there will be a couple sub-folders called “apple”, “banana”, “orange”, and a folder which is called “combined”. After users upload an image, their image will first be saved and moved to the “original” folder, if that is successful, I will then apply image magician to it, and save the new modified image into one of the 3 sub-folders, also saving an copy of that into the “combined” folder. So in total there will be 3 copies of image created. The original image in “original” folder, one copy of the image in one of the 3 sub-folders, and one copy in the “combine” folder.

Secondly, the reason for saving 3 copies of the same image is that on my website, there will be 4 tabs, “apple” , “banana”, “orange” and “mainpage”. Inside “apple” link, there will be all pictures exclusively about apple, and same goes to “banana” and “orange”, and in “mainpage”, there will be all the pictures from “apple” , “banana”, “orange” .

Finally, there will be 4 tables in my SQL, being “mainpage” ,”apple” , “banana”, “orange” and the name of the files will be saved into the tables as well as the created time from the timestamp option, and will then be retrieve from the assigned webpage tabs.
My questions are as following: Is my logic correct? How do I display the images according to the created time in time stamp, I am hoping to list it from new to old.

Thank you so much again for the code, and any feedback would be very much appreciated!
Best regards,
Ray.W

Reply
Ray.W on

Never mind, second question is solved, I just want to know if the logic is correct, thanks!

Reply
Shahrukh Khan on

Hi. Since you are saving the same copy of image in 3+1 folder it doesnt make sense to save the name of the in multiple tables. Here’s what you can do. Save the first image in “Original” folder say “abc.jpg” and then use the same name for when you save a copy for other images in other 4 folders. save the name of the file in the table. Now when you display those images in the tabs just change the folder path for each tabs like for orange “orange/abc.jpg” for apple “apple/abc.jpg”.

Hope this helps you.

Reply
Leonard on

actually i`m making an ordering online .. but i don`t really understand the code.. and also i can`t download the source code … i already share it on my twitter … please help me.. if you don`t mind will you send me the source code in my email..
sorry to say this.. but i`m badly needed that sample .. please thank you.

Reply
Leonard on

ohw.. gosh .. it was just my connection who has failed. that`s why i can`t download.. it`s done sir.. thank you 🙂 <3

Reply
Leonard on

Sir.. if you don`t mind sir.. will you be my mentor .. I`m with my thesis right now and it`s an Ordering Online System with Inventory .. i`m looking forward with your responce sir.. <3

Reply
Shahrukh Khan on

I am glad that you thought that I can be your mentor, but since I am busy with some projects these days I will not be able you devote time to you. Please mail me I will reply to your problem whenever I will find time.

Reply
vijishma on

hi ,
this code working on my localhost but i cant upload image in online server..what is the problem?

Reply
Shahrukh Khan on

its your file permission issue, make sure the file uploading folder has 755 permission

Reply
Frank H. on

This looks like great solution for a project I am trying to complete. However, I just can’t get it to run. Would really like to download the source code but I can’t get the link to unlock. Tried sending some love via Facebook and google+ but nothing happens.

Can I buy this from you?

Reply
Shahrukh Khan on

have you tried double clicking that. anywayz i have emailed you the link. do checkout and let me know.

Reply
Balamurali on

i need a concept of uploading a pofile image in my site and it will be display while the user is login to my site and also it is stored to the database.pls provided the source code for my problem.And send this to
my email id “3dbalamurali@gmail.com”,

Reply
Balamurali on

And i need a source code for the about uploading a multiple image.but it will stored to my database.and display in my site

Reply
Moin Shaikh on

Insert / edit / list form data and multiple images to MySQL database using php
Like OLX so please help

Reply
Shahrukh Khan on

will try to do this another tutorial soon.

Reply
Tristan Curtis on

Any way to include a title for each image? I have already created the table in my database and created the html input field, however I cannot seem to get it to insert with the way this is inserting the data into my database.

Reply
Shahrukh Khan on

It should work the same way as you are inserting the image, make another column in database table “photo_title” and in the same way you are inserting the picture image name in database, same way insert the html input field title in that part.
Note: the image text field will be an array as well and the array index must match with the file input index.

Reply
seenu on

nice job bro 🙂

Reply
Abhinav on

Hi,

I’m working on windows machine and I’m able to upload on first selected image.
I’m getting “The path is not writable. Please check your permissions.” message.
I’ve also tried setting my folder’s permission to Everyone through Properties–>Security.
But unable to achieve the task..

Please help me out.
Thanks

Reply
Ebenezer on

I try to add .pdf to the allow extension but all i get is pdf is not a valid file type

Reply
Shahrukh Khan on

You have to make changes in the php code because there is only check for image mime trype
$valid_image_check = array(“image/gif”, “image/jpeg”, “image/jpg”, “image/png”, “image/bmp”);
add mime type for pdf i guess it will be application/pdf

Reply
Dev on

All my files have been uploaded if they are png , jpeg, bmp but when i upload pdf it says not a valid image. I changed the following code but it doesnot work. Any help will be apppreciated.
$valid_image_check = array(“image/gif”, “image/jpeg”, “image/jpg”, “image/png”, “image/bmp”, “application/pdf”);

Shahrukh Khan on

for pdf you wont be able to create thumbnails. you can only upload it to the server.

pooja on

Hi,
I am uploading multiple images but it is generating thumbnail for 1 image only. I wanted to generate for all images. please help!

Thank you.

Reply
deepak prasad on

How to upload mupltiple file with watermark in codeigniter. Help me brother

Reply
Shahrukh Khan on

code is same.. you need to learn codeignitor mvc pattern first. the integrate the same as per their standards

Reply
PC on

Hello,

your coding working fine, i have to insert image title also but not be able to do so, can u please provide the.

Reply
Faz on

Can I request for demo please?

Reply
credit agricole retiers on

There’s certainly a great deal to learn about this topic.
I really like all the points you have made.

Reply
tia on

Thanks you very much,
This is great tutorial. All are working well.

Reply
Shahrukh Khan on

Thanks

Reply
Sagaljot Singh on

hey my image is not uploading
What can be the reason???

Reply
Shahrukh Khan on

what error message you are getting

Reply
Sagaljot Singh on

My image size and format is ok.
But still it is not uploading file .
Plz try to help!!

Reply
Shahrukh Khan on

is your path correct.

Reply
kenny on

Great work done,please is there a way to add the images to columns instead of rows?,thanks

Reply
Shahrukh Khan on

just put in the column name and use one sql query instead to many

Reply
vegan Purse on

First of ɑll I want to ѕay fantastic blog! I had a
quick question іn which I’d like to аsk
if you doo not mind. I wɑs curious to қnow how you center yоurself аnd
cleaг yⲟur head bᥱfore writing. Ⅰ’vе hɑd trouble clearing my mind іn gеtting my thoughts out.
I truly do take pleasure іn writing Ьut it jᥙst seems liкe tthe first 10 to 15 minutes tend to
be lost simply ϳust trʏing to figre oout ɦow tߋ begin.
Аny suggestions or tips? Ƭhank you!

Reply
Shahrukh Khan on

well before i write the topic i take time in deciding which topic i want to write, and I don’t sit in front of my laptop at that time. After I decide on what i need to write, I just plug in my headphone and just turn off Internet. This helps me. You can give try and let me know if this helps.

Reply
yogesh on

You have this code update multiple images

Reply
Prova on

Hello Shakrukh good tutorial . Someone asked above how to save thumbnails and original image and create different folders for each one. Instead of store to the database, the question is how to store in folders.
In my case I need to create a folder for every user registered.

For creating folders is the following code ?

if(!file_exists($path)){
mkdir($path);

If yes, can you tell please where exactly insert this lines into your code? Thanks!

Reply
Shahrukh Khan on

try before you create the thumnails

Reply
Roma on

You’ve gotten good info at this point.

Reply
FirstCollin on

I have noticed you don’t monetize your page, don’t waste your
traffic, you can earn additional cash every month because you’ve got hi quality content.
If you want to know how to make extra money, search for:
Boorfe’s tips best adsense alternative

Reply
Shahrukh Khan on

Thanks, but my primary motive is to provide helpful resource to the community and money is the last on the list. Although money doesn’t hurt ever. I will do see it, if its fits the bill. Thanks anyways.

Reply
ahmed ja'far hasan on

sir sharukh i want all thumbnails on one side and original in one part/div with prev/next buttons how to do that please reply my bro.

Reply
Shahrukh Khan on

u need to learn HTML for that.

Reply
Amir on

i need to upload pic with pic generate code ,pic name ,pic info?

Reply
Shahrukh Khan on

Add extra columns in the html and give name as array []

Reply
Massimo on

Hi,
Is it possible to limit the form to 10 images?
When I choose “add more” to put a limit to 10?
Thanks for your help
Massimo

Reply
Pater Johann on

Hi,
thanks, but are you sure it works? Can select some images and then after clicking “upload images” the page is blank and nothing happens.
Best

Reply
Shahrukh Khan on

check your php.ini settings it maybe the case where the images being uploaded are exceeds size limit or max execution time exceeds.

Reply
Prageeth on

can you give me the update and delete code for this?

Reply
Kushal on

Thanks bro! your code has worked but my images are all getting rotated 90 degrees left. Why is this happening.

Reply
Waleed Barakat on

Awesome, works great, thanks for your nice work.

Reply
flexi2202 on

Hello.
Well done for the code, it works perfectly.
I have a member’s area with sessions.
Is it possible that each user can save these own images in their space. Thanks for the help

Reply
Shahrukh Khan on

Hi
based on session just change the folders.

Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.