Image Intervention + S3 = weirdness HELP! :(

Posted 8 months ago by shinigaimi

I am attempting to Upload a resized image via Image Intervention, does not work! says success but uploads a folder with no extension

Here is code that does not work!

//Global directory in S3
        $file_path = '' . Auth::User()->comp_id . '/' . $request->prop_id . '/' . $request->page_id . '/pictures/';
foreach ($request->image_upload as $image) {
                //  DRIVERS LICENSE UPLOAD
                // PUTS PICTURES IN USERS FOLDER UNDER "PICTURES FOLDER"


                $image_regular = Image::make($image)->resize($width, $height, function ($constraint) {
                    $constraint->aspectRatio();
                    $constraint->upsize();
                })->orientate();
                $image_upload  = $image_regular->stream();

                //      Upload to AWS with no file resizing
                Storage::disk('s3')->put($file_path, $image_upload->__string(), 'public');
                dd('uploaded to S3');
}

When it uploads it looks like this ->https://imgur.com/a/iG5EeSK

I am able to upload to S3 normally using the code below, this works perfectly fine but I want to resize to a smaller size as you can upload LARGE pictures and I want to create smaller 200x200 thumbnails so the page loads quicker!

            foreach ($request->image_upload as $image) {
                // PUTS PICTURES IN USERS FOLDER UNDER "PICTURES FOLDER"

                //      Upload to AWS with no file resizing
                Storage::disk('s3')->put($file_path, $image, 'public');
                dd('upload to S3');
}

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.