i have a problem with imagejpeg()
. I know how how to save/upload image to s3. My problem now. The image was resize using imagejpeg but this was only save to local directory. I want to save it to s3. I'm using laravel. Here's my code. Any help is appreciated. Thanks
s3 config and path.
$displaypath = '/cover/uploads/csspreview/';
$s3 = \Storage::disk('s3');
$img = $s3->get($data['uploaded_file_path']);
$im = imagecreatefromstring($img);
$width = imagesx($im);
$height = imagesy($im);
$newwidth = '335';
$newheight = '500';
$tuecolor = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($tuecolor, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
// the above code is good.
$path = './uploads/csspreview/'; // this is a local path only.
imagejpeg($tuecolor, $path.'/cover.jpg'); //save image as jpg (It will save to the file but I want it to save in s3)