Skip to main content

How To Reduce or Compress Image Size In Php-Full Detail

How To reduce Image Size In Php

Compress Image In Php-

Hello Friends Ajj Me Apko Btaunga Ki Kis Parkar Ham Imagesize Reduce Kar Sakte Hai Php Ki Help Se.
Ajj Mere Is Post Me Mai Apko  Me Image Compression Tool Bnana Sikhaunga Jiski Madad Se Aap Image Compress Kar Sakte Ho Or Sath He Apne Liye Ek Image Compression Website Aur Tool Teyar Kar Sakte Ho

Aap Is Script Ka Use Karke Upper Dig Ye Website Ki Trah Apne Website Teyar Kar Sakte Ho
Steps-
Yanha Apko Do File Create Karne Hai-
·         Make a index.php-sabse pehle ham ek index.php name se file create karege jis file me ham form bnayege janha image upload karne ka option hoga,is form ka use karke user apni image upload karega.
·         Make a  form.php- ab ham php imagecomression function ka use karke ek script bnayege .yanha ham mainly 3 function ka use karege.
·         Imagecreatefromjpeg
·         Getimagesize-yeh function hame image ke size,width hight ko check karega
·         File_get_contents-ye function file ke content ko sting me read karega.



Sabse pehle aap index.php file me Niche Diya Gya Code Copy Kar Lijiye
Index.php





<center>

Upload Image

<form action="form.php" name="myform" id="myform" method="post" enctype="multipart/form-data">



        

<label>Upload:</label>

                                <input type="file" name="file" id="file"/><br>

<input type="hidden" value="sonu" name="file1"/><br/>

<br>

choose your extension<select name="ext">

<option value=".jpg">.jpg</option>

</select><br/>



<input type="submit" name="submit" id="submit" class="submit btn-success"/>



</form>

</center>





Ab aap ek form.php Name Ki File Bnaiye Or Wanha  Niche Diya Gya Code Paste Kar Dijiye
form.php



<?php



if(isset($_POST['submit'])){



function compress_imagesize($source_url, $dest_url, $quality) {



$info = getimagesize($source_url);



     if ($info['mime'] == 'image/jpeg')

         $image = imagecreatefromjpeg($source_url);



imagejpeg($image, $dest_url, $quality);

return $dest_url;

}



if (

           ($_FILES["file"]["type"] == "image/jpeg"))



{





        $f=$_POST['file1'];



               $ext=$_POST['ext'];

                   $imagename = $f.$ext;



         $filename = compress_imagesize($_FILES["file"]["tmp_name"], $imagename , 50);

         $imageshow = file_get_contents($imagename );



         /* Force download dialog... */

         header("Content-Type: application/force-download");

         header("Content-Type: application/octet-stream");

         header("Content-Type: application/download");



/* Don't allow caching... */

         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");



         /* Set data type, size and filename */

         header("Content-Type: application/octet-stream");

         header("Content-Transfer-Encoding: binary");

         header("Content-Length: " . strlen($imageshow));

         header("Content-Disposition: attachment; filename=$imagename ");



         /* Send our file... */

         echo $imageshow;









     }else{





echo "this formate is not supported";





}

}

?>

Ab Aap Is Program Ko Run Karwakar Dekh Sakte Ho.

Me Ummid Karta Hu Ki Apko Mere Post Achi Lagi Hogi Agar Apko Koi Problem A Rhe Hai To Aap Comment Section Me Puch Sakte Ho Thank You
Team Gajabwap Web In Hindi
 Also Read-
   Meta Tag Generator Tool Kaise Bnaye       

Comments

Popular posts from this blog

How to Download Vimeo Thumbnail With PHP

Vimeo Thumbnail Downloader Tool – Vimeo Video Ka Thumbnail Download Karein Aaj ke is tutorial mein hum Vimeo Thumbnail Downloader Tool ke baare mein jaanenge. Is tool ki help se hum Vimeo video URL se us video ki thumbnail image obtain kar sakte hain. Agar aap PHP, Web Development, HTML, CSS aur Online Tools banana seekh rahe hain, to ye ek useful PHP project example hai. Vimeo Thumbnail Downloader Kya Hai? Vimeo Thumbnail Downloader ek simple tool hai jisme user Vimeo video ka URL enter karta hai. Tool Vimeo video ID ko identify karta hai aur available thumbnail image ko display karta hai. Example Vimeo URL: https://vimeo.com/389063954 Is URL mein: 389063954 Vimeo video ID hai. Vimeo Thumbnail Downloader Kaise Work Karta Hai? Is PHP script mein mainly do functions use kiye gaye hain: 1. getVimeoId() Ye function Vimeo URL se video ID find karta hai. 2. getVimeoThumb() Ye function Vimeo video ID ke basis par thumbnail information retrieve karta hai aur available thumbnail...

How To Create Contact Form With Validation-Php & Html

How To Create Contact Form - Hello Friends Ajj Me Apko Btaunga   Ki Kis Prakar   Ham Apni Website Ke Liye Contact Form Bnana Sakta Hai.( By Using   Php Contact Form With Validation Script ) Contact Form Hmare Website Ke Liye Bhut He Jrruri Hota Hai.Contact Form Ke Help Se He User Apna Message Website Owner(Admin) Ko Bhej Sakte Hai. Ajj Me Apko Btane Wala Hu Ki Kis Parkar Ham Contact Form Banakar Apne Website Me Add Kar Sakte Hai Or Apni Website Ke Liye Contact Form Bana Sakte Hai Is Contact Form Me   Ham Php Mail Function() Ka Use Karege . Ab Jab Be Koi User Contact Form Me Apni Information ,Message Details Fill Karke Submit Karega To Uski Sare Information Website Admin Ke Email Id Par A Jaiyegi Jo Be Admin Dwara   Niche Diye Gye Code Me Setup Ki Hogi. Used Language- ·          HTML ·          Jquery ·          Php ...

How To Send Sms From Website Using Php-Textlocal SMS

Hello Friends Ajj Me Apko Btaunga Ki Kis Prakar Aap Apni Website Me Free Sms Send Ka Option Integrate Kar Sakte Ho. Bulk sms in India-Best company Iske Liye Apko Sabse Pehle   Https://Www.Textlocal.In/Signup Par Signup Karke Account Create Karna Hai.Ye Ek Achi bulk sms provider company hai ·          Account Create Hone Ke Bad Aap Apna Username And Password Enter Karke Apne Dashboard Me Login Ho Jaiye( textlocal login) ·          Yanha Apko Text Local Company Dwara 10 Meassge Free Testing Ke Liye Diye Jayege ·          Aap Sms Plan Buy Kar Sakte Ho Is Company Dwara Bhut He Kam Prize Me Sms Pakage,plan provide  Kiye Jate Hai Textlocal Price Plans –  index.php <?php if(isset($_POST['code']) &&  isset($_POST['mobile'])){ // Authorisation details. $username = "enter your textlocal account email id here"; $hash = "...