本文整理汇总了PHP中AmazonS3::get_object_metadata方法的典型用法代码示例。如果您正苦于以下问题:PHP AmazonS3::get_object_metadata方法的具体用法?PHP AmazonS3::get_object_metadata怎么用?PHP AmazonS3::get_object_metadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AmazonS3
的用法示例。
在下文中一共展示了AmazonS3::get_object_metadata方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
require_once "sdk-1.5.7/sdk.class.php";
error_reporting(-1);
$config = parse_ini_file("aws.ini");
$awsKey = $config["aws.key"];
$awsSecret = $config["aws.secret"];
$bucket = "test.indigloo";
$name = "garbage_bin_wallpaper.jpg";
$options = array("key" => $awsKey, "secret" => $awsSecret, "default_cache_config" => '', "certificate_authority" => true);
$s3 = new AmazonS3($options);
$exists = $s3->if_bucket_exists($bucket);
if (!$exists) {
printf("S3 bucket %s does not exists \n", $bucket);
exit;
}
$mime = NULL;
$response = $s3->get_object_metadata($bucket, $name);
//get content-type of existing object
if ($response) {
$mime = $response["ContentType"];
}
if (empty($mime)) {
printf("No mime found for object \n");
exit;
}
$source = array("bucket" => $bucket, "filename" => $name);
$dest = array("bucket" => $bucket, "filename" => $name);
// caching headers
// expire after 365 days
$offset = 3600 * 24 * 365;
$expiresOn = gmdate('D, d M Y H:i:s \\G\\M\\T', time() + $offset);
$headers = array();
示例2: array
$s3 = new AmazonS3($manage_data['credentials']);
// the key, secret, token
if (pb_backupbuddy::$options['remote_destinations'][$stashDestination]['ssl'] == '0') {
@$s3->disable_ssl(true);
}
$response = $s3->list_objects($manage_data['bucket'], array('prefix' => $manage_data['subkey'] . '/deploy'));
// list all the files in the subscriber account
echo '<pre>';
print_r($response);
echo '</pre>';
foreach ($response->body->Contents as $object) {
print_r($object);
echo '<br><br>';
echo 'Bucket: ' . $manage_data['bucket'] . '<br>';
echo 'Key: ' . $object->Key . '<br>';
$metadata = $s3->get_object_metadata($manage_data['bucket'], $object->Key);
//$metadata = $s3->get_object_metadata( "storage-api-ithemes", "y3xw057s35zp6s4i/deploy-backupbuddy.dat" );
if (false === $metadata) {
echo 'Meta result was FALSE.';
print_r($metadata);
} else {
echo 'Meta Result:<br>';
echo '<pre>';
print_r($metadata);
echo '</pre>';
}
//$contents = $s3->get_object( $manage_data['bucket'], $object['key'] );
//print_r( $contents );
}
}
?>
示例3: foreach
<?if(!isset($_SESSION['auth'])&&isset($_SESSION['msg'])){?>
<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Error!</strong>
<? echo$_SESSION['msg'];?>
</div>
<?
session_destroy();
}?>
<div class="span11">
<?
$i=0;
foreach ($fileList as $file) {
$meta=$s3->get_object_metadata($bucket, $file);
if($i%5==0){
?>
<div class="span12">
<ul class="thumbnails">
<?}?>
<li>
<div class="thumbnail">
<?
$url=$s3->get_object_url($bucket, $file,'15 minutes');
if (isset($_SESSION['auth'])){
?>
<a href="<?echo $url;?>" target="_blank" title="" >
<img src="http://docs.google.com/viewer?url=<?echo $url;?>&a=bi&pagenumber=1&w=180&h=250" alt="" />
示例4: metadata
/**
* retrieve a file's metadata
*
* @param string $filePath
*
* @param array
*/
protected function metadata($filePath)
{
return $this->s3->get_object_metadata($this->bucket, $filePath);
}