protected function _getAuthorizeUrl($redirectUri, $state) { return RequestUtil::buildUrl($this->userLocale, $this->appInfo->getHost()->getWeb(), "1/oauth2/authorize", array("client_id" => $this->appInfo->getKey(), "response_type" => "code", "redirect_uri" => $redirectUri, "state" => $state)); }
/** * Gets a thumbnail image representation of the file at the given path. * * @param string $path * The path to the file you want a thumbnail for (UTF-8). * * @param string $format * One of the two image formats: "jpeg" or "png". * * @param string $size * One of the predefined image size names, as a string: * <ul> * <li>"xs" - 32x32</li> * <li>"s" - 64x64</li> * <li>"m" - 128x128</li> * <li>"l" - 640x480</li> * <li>"xl" - 1024x768</li> * </ul> * * @return array|null * If the file exists, you'll get <code>list(array $metadata, string $data)</code> where * <code>$metadata</code> is the file's * <a href="https://www.dropbox.com/developers/core/api#metadata-details">metadata object</a> * and $data is the raw data for the thumbnail image. If the file doesn't exist, you'll * get <code>null</code>. * * @throws Exception */ function getThumbnail($path, $format, $size) { Path::checkArgNonRoot("path", $path); Checker::argString("format", $format); Checker::argString("size", $size); if (!in_array($format, array("jpeg", "png"))) { throw new \InvalidArgumentException("Invalid 'format': " . self::q($format)); } if (!in_array($size, array("xs", "s", "m", "l", "xl"))) { throw new \InvalidArgumentException("Invalid 'size': " . self::q($format)); } $url = RequestUtil::buildUrl($this->userLocale, $this->contentHost, $this->appendFilePath("1/thumbnails", $path), array("size" => $size, "format" => $format)); $curl = $this->mkCurl($url); $metadataCatcher = new DropboxMetadataHeaderCatcher($curl->handle); $curl->set(CURLOPT_RETURNTRANSFER, true); $response = $curl->exec(); if ($response->statusCode === 404) { return null; } if ($response->statusCode !== 200) { throw RequestUtil::unexpectedStatus($response); } $metadata = $metadataCatcher->getMetadata(); return array($metadata, $response->body); }