我正在改进我的Facebook应用程序。我需要能够调整图像大小,然后将其保存到服务器上的目录中。这是我用来调整大小的代码:
<?php
// The file
$filename = 'test.jpg';
$percent = 0.5;
// Content type
header('Content-type: image/jpeg');
// Get new dimensions
list($width, $height) = getimagesize($filename);
$new_width = $width * $percent;
$new_height = $height * $percent;
// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
// Output
imagejpeg($image_p, null, 100);
?>
我的问题是,我该如何保存这张调整过大小的图片?我需要吗?有没有一种方法可以在不保存它的情况下操作这张调整过大小的图片?