Php supports image scaling. Copy the code as follows :? Php *** Images class is an image processing class * @ packageapplication. controllers * @ since1.0 * classImages {*** Zoom image ** @ param $ source original image
The code is as follows:
/**
* The Images class is an image processing class.
* @ Package application. controllers
* @ Since 1.0
*/
Class Images
{
/**
* Scale an image
* @ Param $ source original image
* @ Param $ newfile New Image
* @ Param $ pre zoom ratio
*/
Public function thumn ($ source, $ pre, $ newfile)
{
// Obtain the image size
List ($ s_w, $ s_h) = getimagesize ($ source );
// Generate a new image size
$ New_w = $ s_w * $ pre;
$ New_h = $ s_h * $ pre;
// Create a new image
$ New_f = imagecreatetruecolor ($ new_w, $ new_h );
// Create an image with a resource image
$ Sour_f = imagecreatefromjpeg ($ source );
// Copy the resource image to the new image
Imagecopyresampled ($ new_f, $ sour_f, 0, 0, 0, 0, $ new_w, $ new_h, $ s_w, $ s_h );
// Output the image to the browser
Imagejpeg ($ new_f, $ newfile );
Imagedestroy ($ new_f );
Imagedestroy ($ sour_f );
}
}
?>
The http://www.bkjia.com/PHPjc/621680.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/621680.htmlTechArticle code is as follows :? Php/*** the Images class is an image processing class * @ package application. controllers * @ since 1.0 */class Images {/*** Zoom image * @ param $ source original image...