当前位置: 首页>>代码示例>>PHP>>正文


PHP AmazonS3::get_bucket_headers方法代码示例

本文整理汇总了PHP中AmazonS3::get_bucket_headers方法的典型用法代码示例。如果您正苦于以下问题:PHP AmazonS3::get_bucket_headers方法的具体用法?PHP AmazonS3::get_bucket_headers怎么用?PHP AmazonS3::get_bucket_headers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AmazonS3的用法示例。


在下文中一共展示了AmazonS3::get_bucket_headers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: transer_dir

 public function transer_dir($image_id)
 {
     $this->EE->load->helper('file');
     // Grab image info
     $query = $this->EE->db->select('field_id, entry_id, filename, extension')->from('exp_channel_images')->where('image_id', $image_id)->limit(1)->get();
     $field_id = $query->row('field_id');
     // Grab settings
     $settings = $this->EE->image_helper->grabFieldSettings($field_id);
     $filename = $query->row('filename');
     $extension = '.' . substr(strrchr($filename, '.'), 1);
     $entry_id = $query->row('entry_id');
     // -----------------------------------------
     // Load Location
     // -----------------------------------------
     $location_type = $settings['upload_location'];
     $location_class = 'CI_Location_' . $location_type;
     // Load Settings
     if (isset($settings['locations'][$location_type]) == FALSE) {
         $o['body'] = $this->EE->lang->line('ci:location_settings_failure');
         exit($this->EE->image_helper->generate_json($o));
     }
     $location_settings = $settings['locations'][$location_type];
     // Load Main Class
     if (class_exists('Image_Location') == FALSE) {
         require PATH_THIRD . 'channel_images/locations/image_location.php';
     }
     // Try to load Location Class
     if (class_exists($location_class) == FALSE) {
         $location_file = PATH_THIRD . 'channel_images/locations/' . $location_type . '/' . $location_type . '.php';
         if (file_exists($location_file) == FALSE) {
             $o['body'] = $this->EE->lang->line('ci:location_load_failure');
             exit($this->EE->image_helper->generate_json($o));
         }
         require $location_file;
     }
     // Init
     $LOC = new $location_class($location_settings);
     // Temp Dir
     @mkdir($this->EE->channel_images->cache_path . 'channel_images/', 0777);
     @mkdir($this->EE->channel_images->cache_path . 'channel_images/transfer/', 0777);
     @mkdir($this->EE->channel_images->cache_path . 'channel_images/transfer/' . $image_id . '/', 0777);
     $temp_dir = $this->EE->channel_images->cache_path . 'channel_images/transfer/' . $image_id . '/';
     // -----------------------------------------
     // Copy Image to temp location
     // -----------------------------------------
     $LOC->download_file($entry_id, $filename, $temp_dir);
     //if ($response !== TRUE) exit($response);
     foreach ($settings['action_groups'] as $group) {
         $size_name = $group['group_name'];
         $size_filename = str_replace($extension, "__{$size_name}{$extension}", $filename);
         $LOC->download_file($entry_id, $size_filename, $temp_dir);
     }
     // -----------------------------------------
     // Init Amazon
     // -----------------------------------------
     if ($_POST['transfer']['to'] == 's3') {
         if (class_exists('CFRuntime') == FALSE) {
             // Include the SDK
             require_once PATH_THIRD . 'channel_images/locations/s3/sdk/sdk.class.php';
         }
         // Just to be sure
         if (class_exists('AmazonS3') == FALSE) {
             include PATH_THIRD . 'channel_images/locations/s3/sdk/services/s3.class.php';
         }
         // Instantiate the AmazonS3 class
         $S3 = new AmazonS3(array('key' => trim($_POST['s3']['key']), 'secret' => trim($_POST['s3']['secret_key'])));
         $S3->ssl_verification = FALSE;
         // Init Configs
         $temp = $this->EE->config->item('ci_s3_storage');
         $s3_storage = constant('AmazonS3::' . $temp[$_POST['s3']['storage']]);
         $temp = $this->EE->config->item('ci_s3_acl');
         $s3_acl = constant('AmazonS3::' . $temp[$_POST['s3']['acl']]);
         $s3_directory = trim($_POST['s3']['directory']);
         $s3_bucket = $_POST['s3']['bucket'];
         $s3_subdir = '';
         if ($s3_directory) {
             $s3_subdir = $s3_directory . '/';
         }
         $s3_headers = $this->EE->config->item('ci_s3_headers');
         // Test it
         $resp = $S3->get_bucket_headers($s3_bucket);
         if (!$resp->isOK()) {
             if (isset($resp->body->Message)) {
                 exit('ERROR_S3: ' . $resp->body->Message);
             } else {
                 exit('ERROR_S3: Bucket error');
             }
         }
     } else {
         // Include the SDK
         if (class_exists('CF_Authentication') == FALSE) {
             require_once PATH_THIRD . 'channel_images/locations/cloudfiles/sdk/cloudfiles.php';
         }
         // Which Region?
         if ($_POST['cloudfiles']['region'] == 'uk') {
             $_POST['cloudfiles']['region'] = constant('UK_AUTHURL');
         } else {
             $_POST['cloudfiles']['region'] = constant('US_AUTHURL');
         }
         // Instantiate the Cloudfiles class
//.........这里部分代码省略.........
开发者ID:ayuinc,项目名称:laboratoria-v2,代码行数:101,代码来源:ajax.channel_images.php


注:本文中的AmazonS3::get_bucket_headers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。