Posted inProgramming / Mysql / Mysqli / php

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!.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype