File Upload – Auto Resize Compress-Reduce image using PHP

File Upload – Auto Resize Compress-Reduce image using PHP

Today, We want to share with you File Upload – Auto Resize Compress-Reduce image using PHP.
In this post we will show you File Upload – Auto Resize Compress-Reduce image using PHP, hear for File Upload – Auto Resize Compress-Reduce image using PHP we will give you demo and example for implement.
In this post, we will learn about File Upload – Auto Resize Compress-Reduce image using PHP with an example.

In this Post,Going to show little bit advance of Auto Resize Compress-Reduce image uploading your server or folder.Means of Resize Image While Uploading with PHP

First of all we create on images Folder in Root directory based.nad then home-main.php create a file in this place.It was based on php script to simple Auto Resize Compress-Reduce image upload functionality.

home-main.php

This script resize your uploaded an Image into two 186px and 76px.new Take a look at simple $newwidth and newheight created you have to modify size values.(Image Like as a jpg,png,etc.)

Here in this POST,is a very quick and Fast easy to source code, simple script to do it:

<input class="form-control" name="stitle" placeholder="Apps Title" type="text" value="">
<input type="file" class="file" name="Appslfile" value=""/>
<img src="../images/" height="76px" width="168px" class="img-rounded"/>

do-mst.php

query("UPDATE `setting` SET `stvalue`='$stitle' WHERE `stid`=1");
	}
	
	if(move_uploaded_file($_FILES["Appslfile"]["tmp_name"], $target_file)) 
	{
		$stitle=$db->query("UPDATE `setting` SET `stvalue`='$ck_img_name' WHERE `stid`=2");
		
		$orig_image = imagecreatefromjpeg($target_file);
		$temp_img_info = getimagesize($target_file); 
		$width_orig  = $temp_img_info[0]; // current orignal width as found in image file
		$height_orig = $temp_img_info[1]; // current orignal height as found in image file
		$width = 186; // Simple new image user custom width
		$height = 76; // simple new image user custom height
		$des_img_logo = imagecreatetruecolor($width, $height);
		imagecopyresampled($des_img_logo, $orig_image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
		
		imagejpeg($des_img_logo, $target_file, 100);
		
	}
	header("Location: home-main.php");
}
?>

: Example :

We hope you get an idea about File Upload – Auto Resize Compress-Reduce image using PHP
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.

Leave a Comment