Amazon S3 PHP Stream Wrapper Set Public View Permissions for Image -
i'm using amazon php sdk s3 save images bucket. need make sure every image gets added publicly viewable, don't want add list accessibility. couldn't find way set @ bucket level propagated uploaded images.
so, question is, how set permissions on image after move s3 can viewed in browser?
my code looks this:
require_once("aws/aws-autoloader.php"); // amazon s3 use aws\s3\s3client; // create amazon s3 client object $s3client = s3client::factory(array( 'key' => $amazonkey, 'secret' => $amazonsecret )); // register stream wrapper client object $s3client->registerstreamwrapper(); // save thumbnail $s3path = "s3://".$amazonbucket."/".$folderyear."/".$foldermonth."/"; $s3stream = fopen($s3path . $thumbnail, 'w'); fwrite($s3stream,$thumb_content); @fclose($s3stream);
i need after image has been saved, how can make sure image publicly viewable bucket , folders not list contents.
you can set @ bucket level using bucket policies. check out:
http://docs.aws.amazon.com/amazons3/latest/dev/usingbucketpolicies.html
Comments
Post a Comment