Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kekekiw123's avatar

What is the Stream() function in image intervention

I wonder what the stream() function in image intervention does? http://image.intervention.io/api/stream

Right now I am uploading my images to amazon S3 like this:

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,
    ]);

  }

But is the stream function something I need to add?

0 likes
0 replies

Please or to participate in this conversation.