Resize images with PHP, support PNG, JPG

前端 未结 7 1414
囚心锁ツ
囚心锁ツ 2020-12-08 01:37

I am using this class:

class ImgResizer {

function ImgResizer($originalFile = \'$newName\') {
    $this -> originalFile = $originalFile;
}
function resiz         


        
7条回答
  •  被撕碎了的回忆
    2020-12-08 02:12

    I know this is very old thread, but I found PHP has imagescale function built in, which does the required job. See documentation here

    Example usage:

    $temp = imagecreatefrompng('1.png'); 
    $scaled_image= imagescale ( $temp, 200 , 270);
    

    Here 200 is width and 270 is height of resized image.

提交回复
热议问题