Beispiel #1
0
     //$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;
     }
     if (!isset($_GET['path'])) {
         header("Location: " . getPath(""));
         exit;
     }
     $path = $_GET['path'];
     $_picture = new DataManager('Picture');
     //    $_picture->setField('userId', 1);
     //    $_picture->setField('path', $path);
     $_picture->load($_GET['id']);
     $fd = tmpfile();
     //$metadata = $dbxClient->getFile($path, $fd);
     //$metadata = $dbxClient->getThumbnail($_GET['path'], 'png', 'xl');
     header("Content-Type: " . $_picture->getField('mime_type'));
     fseek($fd, 0);
     fwrite($fd, $_picture->getField('image'));
     fseek($fd, 0);
     fpassthru($fd);
     fclose($fd);
 } else {
     if ($requestPath == "/download") {
         //$dbxClient = getClient();
         $user = $db->getOne('user');
         $dbxClient = new dbx\Client($user['session'], "PHP-Example/1.0");
         if ($dbxClient === false) {