PHP and MySQL Upload with Resize Image

If you’re searching on a short, direct and simple PHP and MySQL upload and re-size script, well you’re in the right place folks, today I’ll share you how easily this scripts is and I’m using this script too in my web projects and it works fine, one of the CMS that uses this method is WordPress of course there’s a lot more 😉

Why we have to re-size image?

The answer is pretty simple, although there are lots that are need to consider but the most common are, first server load and space second web speed (remember Google love faster website) and more, hey it’s an optional so if you have SSD and lighting speed server then you don’t need to re-size images 🙂

Okay lets go, are you ready?


This contains HTML form code for upload.

PHP Code

These script simply re-size image into two, 50px and 100px and before saving into database it added time stamp into the image(s) name, this to avoid conflict in other previous uploaded images.

I’ll add comment as long as I can so no need to tear the code apart and explain line by line, hope this work for you guys.

PHP Function

A very simple PHP function to get and return the file extension.

Final Words: How and when this snippet is useful? this code is very useful to less your server load, and to lighten your site display by using re-sized images, Google love faster website so of course SEO 😉

Happy coding ^_^

by Ryan Sutana

  • This is usually a good blog post. best wishes a lot for any fantastic knowledge and that we truly enjoy some time people latched onto create this specific. give thanks to yet again.

  • This script upload and resize image. Select your image and image will resize to 200×200 px and 50×50 px.

  • Cindy Porter

    I love it! Excellent article. I need help with this too! Maybe you would be interested in an online service where you can merge any documents you want. I used it to fill out