Exemple #1
0
     //$dbxClient = getClient();
     $_GET['path'] = base64_decode($_GET['path']);
     $user = $db->getOne('user');
     $dbxClient = new dbx\Client($user['session'], "PHP-Example/1.0");
     if ($dbxClient === false) {
         header("Location: " . getPath("dropbox-auth-start"));
         exit;
     }
     if (!isset($_GET['path'])) {
         header("Location: " . getPath(""));
         exit;
     }
     $path = $_GET['path'];
     $fd = tmpfile();
     //$metadata = $dbxClient->getFile($path, $fd);
     $metadata = $dbxClient->getThumbnail($_GET['path'], 'png', 'xl');
     header("Content-Type: " . $metadata[0]['mime_type']);
     fseek($fd, 0);
     fwrite($fd, $metadata[1]);
     fseek($fd, 0);
     fpassthru($fd);
     fclose($fd);
 } else {
     if ($requestPath == "/thumb2") {
         //$dbxClient = getClient();
         $user = $db->getOne('user');
         $dbxClient = new dbx\Client($user['session'], "PHP-Example/1.0");
         if ($dbxClient === false) {
             header("Location: " . getPath("dropbox-auth-start"));
             exit;
         }