現在、画像のサイズを変更してファイルに書き込んでいます。それ以来、Amazonに保存する必要があったので、必要なのはサイズ変更された画像の内容だけです. 最初にファイルに書き込まずにこれを行うことはできますか?
これは私の現在のコードがどのように見えるかです:
$success = $src_img && @imagecopyresampled(
$new_img,
$src_img,
$dst_x,
$dst_y,
0,
0,
$new_width,
$new_height,
$img_width,
$img_height
) && imagejpeg($new_img, $new_file_path, $image_quality);
// Free up memory (imagedestroy does not delete files):
@imagedestroy($src_img);
@imagedestroy($new_img);
$type = $this->get_file_type($new_file_path);
$binary = file_get_contents($new_file_path);
$image = $this->get_user_path() . $version . '/' . $file_name;
$response = $this->S3->create_object(AWS_S3_BUCKET, $image, array( 'body' => $binary, 'contentType' => $type, 'acl' => AmazonS3::ACL_PUBLIC));
if ($response->isOK()) {
// success
}
最初にファイルに書き込まずにファイルの内容を取得するにはどうすればよいですか?