/** * 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(); }