Turn Your Vehicle Into a Smart Earning Asset

While you’re not driving your car or bike, it can still be working for you. MOTOSHARE helps you earn passive income by connecting your vehicle with trusted renters in your city.

🚗 You set the rental price
🔐 Secure bookings with verified renters
📍 Track your vehicle with GPS integration
💰 Start earning within 48 hours

Join as a Partner Today

It’s simple, safe, and rewarding. Your vehicle. Your rules. Your earnings.

How to Upload and Resize an Image using PHP.

In this post, we are going to learn how to upload and resize an image using PHP. Here we going to use simple PHP code for image upload and resize that image with the help of user-submitted image file data.

When Users upload images to the server then at that time page will not be refresh and after completing image upload it will display an image on the web page without page refresh.

I have made some validation for uploading images. Validation like the image is selected or not, allowed image file formate, size of the image. If this validation passes the image file then after it will upload to the server.

Step 1: Create a new index.php.

Here we need to define form with file input tag and enctype=”multipart/form-data” form Enctype method. It will help us to choose and submit the image file to a PHP script.

Step 2: Resize image PHP code.

Here we are going to define an image upload handling process scripts with thumbnail image creation form an original file.

Here the complete code:

And, also create an uploads name folder for upload and download the image.

Then, RUN these index.php file, you can see the view.

Then, Select the Width, Height and Choose image.

See the result:

Download the Source Code:

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.