image icon indicating copy to clipboard operation
image copied to clipboard

Use cloud storage (s3) with putFileAs

Open SergejSi opened this issue 3 years ago • 1 comments

Hey, is there a way to use PutFileAs and Intervention Image for large image files? I have the following code:

` $photo = Image::make($image)->encode('jpg', 70); $name = $image->hashName();

	try {
		$photo->widen(160);
		$this->storeImage('lg_'.$name, $photo);
                  Storage::disk('...')->putFileAs(path..., $image->basePath(),$name);

		$photo->widen(40);
		$this->storeImage('xs_'.$name, $photo);
                 Storage::disk('...')->putFileAs(path..., $image->basePath(),$name);


	} catch ( \Exception $e ) {
		throw new HttpException(500, $e->getMessage());
	}

`

Unfortunately, the manipulation is not taken over. In both cases, the image is saved in its original size. Is there any solution for this?

Thanks!

SergejSi avatar Apr 18 '22 23:04 SergejSi

Not sure I follow your code correctly, is storeImage a method that contains the Storage::disk call?

In any case, $image->basePath() refers to the original source file so if you store that in S3 then it will store the original image right? You'll need to output the processed image in order to save it: https://image.intervention.io/v2/usage/overview#image-output

nztim avatar May 01 '22 21:05 nztim