Example #1
0
 /**
  * Return the image style URL associated with this URL.
  *
  * @param string $styleName
  *   The name of the image style.
  *
  * @return \Drupal\amazons3\S3Url
  *   An image style URL.
  */
 public function getImageStyleUrl($styleName)
 {
     $styleUrl = new S3Url($this->getBucket());
     $styleUrl->setPath("/styles/{$styleName}/" . $this->getKey());
     return $styleUrl;
 }
Example #2
0
 /**
  * @expectedException \InvalidArgumentException
  * @covers Drupal\amazons3\S3Url::factory
  */
 public function testFactoryInvalidUrl()
 {
     $url = S3Url::factory(':');
 }
Example #3
0
 /**
  * Get a regular S3 URL for a key.
  *
  * @param string $key
  *   The S3 object key.
  * @param int $expiry
  *   (optional) Expiry time for the URL, as a Unix timestamp.
  * @param array $args
  *   (optional) Array of additional arguments to pass to getObjectUrl().
  *
  * @return \Guzzle\Http\Url
  *   An https URL to access the key.
  */
 protected function getS3Url($key, $expiry = NULL, array $args = array())
 {
     $url = Url::factory(static::$client->getObjectUrl($this->uri->getBucket(), $key, $expiry, $args));
     $this->injectCname($url);
     return $url;
 }