public function __construct($url, File $file = null) { parent::__construct($url, $file); $this->embed = Embed::create($url); if (!$this->embed) { $controller = Controller::curr(); $response = $controller->getResponse(); $response->addHeader('X-Status', rawurlencode(_t('HTMLEditorField.URLNOTANOEMBEDRESOURCE', "The URL '{url}' could not be turned into a media resource.", "The given URL is not a valid Oembed resource; the embed element couldn't be created.", array('url' => $url)))); $response->setStatusCode(404); throw new HTTPResponse_Exception($response); } }
public function __construct($url, File $file = null) { parent::__construct($url, $file); if ($file) { return; } // Get size of remote file $size = @filesize($url); if ($size) { $this->size = $size; } // Get dimensions of remote file $info = @getimagesize($url); if ($info) { $this->width = $info[0]; $this->height = $info[1]; } }