PHP Save Image After imagecopyresampled

后端 未结 6 2257
执笔经年
执笔经年 2021-02-19 16:14
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_heig         


        
6条回答
  •  你的背包
    2021-02-19 16:55

    After you applied imagecopyresampled(), the $dst_image will be your image resource identifier.

    Just applying the imagecopyresampled() function does not automagically also save it to the file system.

    So you will need to save it, using one of the functions imagejpeg(), imagepng()

    // Output
    imagejpeg($dst_image, 'new-image.jpg', 100);
    

提交回复
热议问题