Re: How to reduce the image size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi man,

There are lots of codes in php.net itself . If you need something you may need to browse through it . 

This is a sample I have got from there . I have not tried it . But this is how it works . You can look the functions and get more details ..



<?php
// File and new size
$filename = 'test.jpg';
$percent = 0.5;

// Content type
header('Content-type: image/jpeg');

// Get new sizes
list($width, $height) = getimagesize($filename);
$newwidth = $width * $percent;
$newheight = $height * $percent;

// Load
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);

// Resize
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);

// Output
imagejpeg($thumb);
?>


    

http://us2.php.net/manual/en/function.imagecopyresized.php



Hari K T

http://harikt.com/


--- On Tue, 1/9/09, hno <hno2005@xxxxxxxxx> wrote:

From: hno <hno2005@xxxxxxxxx>
Subject:  How to reduce the image size
To: php-objects@xxxxxxxxxxxxxxx
Date: Tuesday, 1 September, 2009, 10:42 PM






 




    
                  HI



How can reduce the image size in php ?



Best Regards



HNO



[Non-text portions of this message have been removed]




 

      

    
    
	
	 
	
	








	


	
	


      Beauty is just a click away. Find beauty parlor listings on Yahoo! India Local http://in.local.yahoo.com/

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux