Hello, the $disk->put part in the else block doesn't specify a filename
Multipart file upload to S3
Hey guys! I'm trying to do a multipart file upload to an S3 bucket, but i'm coming across a few issues. The directories are being created and the thumbnail is being uploaded, but the main images are not uploading and there is a strange file appearing alongside the directory. This is what I have:
$files = $request->file('images');
$count = 0;
foreach($files as $file) {
$img = \Image::make($file);
//resize width to 910px and preserve aspect ratio
//save images and thumbs
if($count == 0){
$img->fit(1080, 578)->encode('jpg', 85);
$disk->put('/images/'.$slug.'/'.$slug.'-'.$count.'.jpg', $img->__toString());
$img->fit(400, 267)->encode('jpg', 85);
$disk->put('/images/'.$slug .'/thumbnails/'.$slug.'-thumb.jpg', $img->__toString());
$img->destroy();
++$count;
}else{
$img->fit(1080, 578)->encode('jpg', 85);
$disk->put('/images/'.$slug.'/', $img->__toString());
++$count;
}
I'm basically looping through the images array, creating and uploading a thumb from the first image and then uploading each image (with a little intervention manipulation).
i've dumped the images array to make sure it has more than one image. There is a strange file being uploaded to the bucket with each image also. It's appear to have encoded data from the images in it. Not quite sure where to go to from here as there are not a lot of resources about L5 multipart uploads to S3 buckets.
Any help would be much appreciated.
EDIT: $disk is just a variable holder for Storage::disk(s3) and $slug is just another field sluggified
Please or to participate in this conversation.