public function testCanReturnAddedTransformations()
 {
     $this->assertSame(array(), $this->url->getTransformations(), 'Transformations sould initially be an empty array');
     $this->url->thumbnail()->desaturate()->png();
     $this->assertSame(array('thumbnail:width=50,height=50,fit=outbound', 'desaturate'), $this->url->getTransformations(), 'Could not fetch transformations after adding');
     $this->url->reset();
     $this->assertSame(array(), $this->url->getTransformations(), 'Resetting the URL did not clear the added transformations');
 }
Beispiel #2
0
 /**
  * Generate a short URL
  *
  * @param Http\ImageUrl $imageUrl An instance of an imageUrl
  * @return Model
  */
 public function generateShortUrl(Http\ImageUrl $imageUrl)
 {
     $transformations = $imageUrl->getTransformations();
     if ($transformations) {
         $transformations = '?t[]=' . implode('&t[]=', $transformations);
     } else {
         $transformations = null;
     }
     $params = array('user' => $this->getUser(), 'imageIdentifier' => $imageUrl->getImageIdentifier(), 'extension' => $imageUrl->getExtension(), 'query' => $transformations);
     return $this->getCommand('GenerateShortUrl', array('user' => $this->getUser(), 'imageIdentifier' => $imageUrl->getImageIdentifier(), 'params' => json_encode($params)))->execute();
 }