Download a thubnails of an image using Dropbox API for php


I made a script where I download the images from a dropbox folder to my computer using PHP. What I try to do now is to download thumbnail of the images instead of the whole image. For this I use the: GetThumbNail method from the Dropbox API. Here is part of the code:

// download the files $f = fopen($img_name, "w+b"); $fileMetadata = $dbxClient->getThumbnail($path, 'jpeg','xl'); fclose($f);

When I run this the images I get are 0 size and they have no content. Any ideas what I am missing? Thanks D.


$f = fopen($img_name, 'w+b'); $thumbnailData = $dbxClient->getThumbnail($path, 'jpeg', 'xl'); fwrite($f, $thumbnailData); fclose($f);


You're opening and closing $f without ever writing anything into it.

<a href="http://dropbox.github.io/dropbox-sdk-php/api-docs/v1.1.x/class-Dropbox.Client.html#_getThumbnail" rel="nofollow">getThumbnail</a> returns an array with two elements: the metadata for the file and the thumbnail data.

So I think you'll want something like this:

$f = fopen($img_name, 'w+b'); list($fileMetadata, $thumbnailData) = $dbxClient->getThumbnail($path, 'jpeg', 'xl'); fwrite($f, $thumbnailData); fclose($f);


  • Recursively extracting values from within a text file and looping over more of them plus rearranging
  • Pointers using a 32 bit DLL in a 64 bit service
  • function inside for loop (js/jquery)
  • Read more button in my blog with php [closed]
  • how to get the particular sub view id from the view in android?
  • VGG 16/19 Slow Runtimes
  • Out of memory exception while implementing image gallery
  • How to delete a row in a table using jQuery?
  • How to get the revision of an item with Dropbox API
  • cannot run python script file using windows prompt
  • Pass pointer array to function
  • input type=“file” accept=“image/*” doesn't work in phone gap?
  • get src attribute of an image based on class or id
  • Serve file to user over http via php
  • How can I get the choice “H2” back in the H2 consol?
  • Security issues with PHP's Readfile method
  • How to attach a node.js readable stream to a Sendgrid email?
  • What is Eclipse's Declaration View used for?
  • Resize panoramic image to fixed size
  • Hazelcast - OperationTimeoutException
  • Jquery - Jquery Wysiwyg return html as a string
  • SVN: Merging two branches together
  • RestKit - RKRequestDelegate does not exist
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • How do I rollback to a specific git commit
  • Is there a mandatory requirement to switch app.yaml?
  • Revoking OAuth Access Token Results in 404 Not Found
  • Acquiring multiple attributes from .xml file in c#
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How can I remove ASP.NET Designer.cs files?
  • Append folder name and increment by 1 using batch script
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Easiest way to encapsulate a HTML5 webpage into an android app?
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal