0
画像介入のstream()関数は何をしているのでしょうか? http://image.intervention.io/api/streamphp laravel画像介入のStream()関数とは何ですか
は、今のところ私はこのようなアマゾンS3に自分の画像をアップロードしています:Intervention Docsあなたは上記きた中で書かれた
public function uploadLargeAndMainImages($file,$adId)
{
$s3 = Storage::disk('s3');
$extension = $file->guessExtension();
$filename = uniqid() . '.' . $extension;
//Create and resize images
$image = Image::make($file)->resize(null, 600, function ($constraint) {
$constraint->aspectRatio();
});
$image->encode($extension);
$imageLarge = Image::make($file)->resize(null, 800, function ($constraint) {
$constraint->aspectRatio();
});
$imageLarge->encode($extension);
// upload image to S3
$s3->put("images/{$adId}/main/" . $filename, (string) $image, 'public');
$s3->put("images/{$adId}/large/" . $filename, (string) $imageLarge, 'public');
// make image entry to DB
$file = File::create([
'a_f_id' => $adId,
'file_name' => $filename,
]);
}
「画像データに基づいて新しいPSR-7ストリームを作成する」 私はすでにエンコード機能を使用しています。 http://image.intervention.io/api/encodeほとんど同じように見える – user2636197
PSR 7はエンコードしない新しいエンコード標準です。http://www.php-figを参照してください。 org/psr/psr-7/ –
情報をありがとう!私は今あなたの答えを受け入れました:)これは話題ですが、PSR 7に切り替える必要がある理由はありますか? – user2636197