Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $filename='group_image'.$group_id.'.jpg';
- // save image in output Buffer --
- ob_start();
- imagejpeg($outputImage,NULL,100);
- $imageFileContents = ob_get_contents();
- // header('Content-Type: image/png');
- // imagepng($imageFileContents);
- // use AwsS3S3Client;
- $directory = 'uploads/images/'.$filename;
- // Create an Amazon S3 client object
- $client = S3Client::factory(array(
- 'secret' => 'RtzcCuO2yLnHWtFpjcpNaPHdFKhI4QfaICSngw4q',
- 'key' => 'AKIAJAJRA6ZVHKUBHW7A'
- ));
- $context = stream_context_create(array(
- 's3' => array(
- 'ACL' => 'public-read'
- )
- ));
- // Register the stream wrapper from a client object
- $client->registerStreamWrapper();
- $bucket = 'momentsbucket';
- $key = $directory;
- // save content on S3 --
- $contents = file_put_contents("s3://{$bucket}/{$key}",$imageFileContents,0,$context);
- $size = filesize("s3://{$bucket}/{$key}");
- ob_end_clean(); // clear o/p buffer
Add Comment
Please, Sign In to add comment