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


PHP AmazonS3::get_object_url方法代码示例

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


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

示例1: store

 /**
  * Store Upload file to S3.
  * @param CUploadedFile $uploadedFile
  * @param string $bucket The file to create the object
  * @return string url to the file.
  */
 public function store($uploadedFile, $bucket = NULL)
 {
     if ($this->config['randomPath']) {
         $filePath = $this->config['pathPrefix'] . md5(date('His')) . '/' . $uploadedFile->getName();
     } else {
         $filePath = $this->config['pathPrefix'] . $uploadedFile->getName();
     }
     if ($bucket === NULL) {
         $bucket = $this->config['defaultBucket'];
     }
     /** @var CFResponse $result */
     $result = $this->s3->create_object($bucket, $filePath, array('fileUpload' => $uploadedFile->getTempName(), 'acl' => $this->config['defaultACL']));
     if ($result->isOk()) {
         return urldecode($this->s3->get_object_url($bucket, $filePath));
     } else {
         Yii::log("STATUS:" . $result->status . "\nHEDAER:" . $result->header . "\nBODY:" . $result->body, CLogger::LEVEL_ERROR, "application");
         throw new CException($result->status);
     }
 }
开发者ID:jamesmoey,项目名称:yii-amazon,代码行数:25,代码来源:AmazonS3Component.php

示例2: array

    mysql_close($conn);
    $newFileName = md5($username . $deviceID) . "_";
    $s3 = new AmazonS3();
    $bucket = 'com.sanchitkarve.tb.usor';
    $response = $s3->get_object_list($bucket);
    $userFiles = array();
    $foundFiles = false;
    foreach ($response as $item) {
        if (startsWith($item, $newFileName)) {
            $userfiles[] = $item;
            $foundFiles = true;
        }
    }
    // create cloudfront link if possible
    $urls = "";
    //print_r($response);
    if ($foundFiles) {
        foreach ($userfiles as $uitem) {
            $link = $s3->get_object_url($bucket, $uitem, '10 minutes');
            // replace domain with cloudfront and put them in urls
            $urls .= $link . " ";
        }
        //remove last space
        $urls = trim($urls);
        echo $urls;
    } else {
        echo "NOFILES";
    }
} else {
    echo "Error: Not all parameters set.";
}
开发者ID:nikunjkacha,项目名称:ThalliumBackup-Cloud,代码行数:31,代码来源:download.php

示例3: getFileUrl

 /**
  * Get the S3 absolute URL for the specified path
  *
  * @param string $path The path by which to grab the URL
  * @param string $expires The time in which the URL expires
  * @return bool|mixed|string
  */
 public function getFileUrl($path, $expires = null)
 {
     return $this->s3->get_object_url($this->bucket, $path, $expires);
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:11,代码来源:modaws.class.php

示例4: filter_file_list

        $s3->batch()->create_object($bucket, $filename, array('fileUpload' => $file));
    }
    /* Execute our queue of batched requests. This may take a few seconds to a
       few minutes depending on the size of the files and how fast your upload
       speeds are. */
    $file_upload_response = $s3->batch()->send();
    /* Since a batch of requests will return multiple responses, let's
       make sure they ALL came back successfully using `areOK()` (singular
       responses use `isOK()`). */
    if ($file_upload_response->areOK()) {
        // Loop through the individual filenames
        foreach ($individual_filenames as $filename) {
            /* Display a URL for each of the files we uploaded. Since uploads default to
               private (you can choose to override this setting when uploading), we'll
               pre-authenticate the file URL for the next 5 minutes. */
            echo $s3->get_object_url($bucket, $filename, '5 minutes') . PHP_EOL . PHP_EOL;
        }
    }
}
/*%******************************************************************************************%*/
// HELPER FUNCTIONS
// Filters the list for only files
function filter_file_list($arr)
{
    return array_values(array_filter(array_map('file_path', $arr)));
}
// Callback used by filter_file_list()
function file_path($file)
{
    return !is_dir($file) ? realpath($file) : null;
}
开发者ID:anil-kodali,项目名称:aws-sdk-for-php,代码行数:31,代码来源:cli-s3_get_urls_for_uploads.php

示例5: foreach

 }?>
 <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="" /> 
                     </a>
                     <?}
                     else{
                     ?>
                     <a rel="popover" href="#" title="" data-title="<? echo $meta['Headers']['x-amz-meta-title'];?>" data-content='<p>Sign in to view/download the book</p>' data-placement="right" data-trigger="hover" class="example"> 
                     <img src="http://docs.google.com/viewer?url=<?echo $url;?>&a=bi&pagenumber=1&w=180&h=250" alt="" /> 
                     </a>
                     <?}?>
                 </div>
                 <div class="bTitle"><? echo $meta['Headers']['x-amz-meta-title'];?></div>
开发者ID:raveebhat,项目名称:BookPortal,代码行数:31,代码来源:index.php

示例6: getObjectUrl

 /**
  * Returns the URL for an object saved on Amazon S3.
  *
  * @param string $path
  *
  * @return string
  */
 protected function getObjectUrl($path)
 {
     return $this->storage->get_object_url($this->bucket, $path, 0, $this->objUrlOptions);
 }
开发者ID:umanit,项目名称:LiipImagineBundle,代码行数:11,代码来源:AmazonS3Resolver.php

示例7: split

if (isset($_GET['load'])) {
    $dbData = $db->Raw("SELECT `user`,`link`,`type`,`server` FROM `userdb_uploads` WHERE `xid`='{$xid}'");
    $type = $dbData[0]['type'];
    $server = $dbData[0]['server'];
    if ($type == 'upload' && $server != 's3') {
        $linkSplit = split("/", $dbData[0]['link']);
        $drive = $linkSplit[4];
        $userFolder = $linkSplit[5];
        $fileName = $linkSplit[6];
        $t_hex = sprintf("%08x", time());
    }
    $db->logActivity($dbData[0]['user'], 'logStart', $xid);
    $link = $dbData[0]['link'];
    if ($server == 's3') {
        $s3 = new AmazonS3();
        $link = $s3->get_object_url('fb-music', $link, '10 seconds');
    }
    $link = urlencode($link);
    if ($type == 'upload' && $server != 's3') {
        $link_type = 1;
        echo "linkType=" . $link_type . "&t_hex=" . $t_hex . "&drive=" . $drive . "&userFolder=" . $userFolder . "&filename=" . $fileName . "";
    } else {
        $link_type = 2;
        echo "linkType=" . $link_type . "&link=" . $link . "";
    }
} else {
    if (isset($_GET['logFullPlay'])) {
        $dbData = $db->Raw("SELECT `user` FROM `userdb_uploads` WHERE `xid`='{$xid}'");
        $db->logActivity($dbData[0]['user'], 'logFullPlay', $xid);
    }
}
开发者ID:sjlu,项目名称:fb-music-app,代码行数:31,代码来源:player-callback.php


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