How to Resize and Upload an Image in PHP

0
1163

uploadresizePicImage

In this tutorial, I will teach you how to resize and upload an image in php. .  This method can control the size of the images when uploading it on your website. It also optimize your web pages and lessen the load of time for a faster browsing experience.

Lets begin:

  1. Create the landing page of your project and name it “index.php”.  Copy  this following code and paste it into file.

[php]
<!– extension bootstrap css –>
<link rel=”stylesheet” type=”text/css” href=”css/bootstrap.min.css”>

<h1 align=”center”>Upload and Resize an Image</h1>

<form action=”upload.php” method=”POST” enctype=”multipart/form-data” >
<div class=”container”>
<div class=”row”>
<div class=”col-md-6″>
<div class=”col-md-12″>
<label class=”col-md-3″>Upload Image</label>
<input id=”photo” name=”photo” type=”file”>
</div>
<div class=”col-md-12″>
<label class=”col-md-3″>Choose size</label>
<select name=”size_option”>
<option>Small</option>
<option>Medium</option>
<option>Large</option>
</select>
<input type=”submit” id=”submit” name=”submit” value=”upload”>
</div>

</div>
</div>
<hr/>
<div class=”row”>
<div class=”col-md-12″>
<?php
if (isset($_GET[‘image’])) {

header(‘Location: index.php?image=’.$file_name);
exit;

}
?>

[/php]

 

For all students who need programmer for your thesis system or anyone who needs a sourcecode in any programming languages.  You can contact me @ :

Email – [email protected]

Mobile No. – 09305235027 – tnt

 

Dowload the sourcecode here

Looking for more source code? Type your keyword here here!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

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