As digital cameras evolve, including the ones in our smartphones, photos produced by them constantly increase in resolution and file size. For instance, on my current smartphone, the average file size of pictures goes between 6-8 MB, when the ones produced by my 3-year-old smartphone average 2-3 MB.
Having a large file size is not a problem when previewing images directly in the Dropbox website or the Dropbox mobile apps as these surfaces are optimized for large files, but presents challenges when interacting with other APIs.
If you’re transferring your images to a third party API for processing (like an image recognition AI),
We’ve been testing a new document preview API with developers over the past few weeks and are happy to announce that it is ready for everyone! This API endpoint makes it easy to show previews of files from within your app and supports the most popular document formats including PDF, Microsoft Word, PowerPoint, and Excel.
Kevin Henrikson is the Cofounder & VP Engineering of Acompli and here are his thoughts on the new document preview API.
Acompli combines email, calendar, file sharing, and contacts. We created the ability to view and attach files to email but we wrestled with the ability to show users an accurate preview of those files.
Until now, retrieving a file’s metadata and its content required two API calls – one to retrieve the metadata and another to get the file’s contents at the revision indicated in the metadata.
We recently updated the /files REST API call to start returning the file’s metadata in a special header (
x-dropbox-metadata) in the HTTP response. Accordingly, we extended all the official SDKs to expose the metadata along with the file’s contents when a client requests a file download. We also made a similar change to the /thumbnails call (and added corresponding methods to the SDKs) that returns the metadata for the file whose thumbnail is being requested.
We’ve got some quick fixes lined-up to round out some of the edges on the API. First up: improvements to thumbnails and icons, all aimed at getting your apps looking good for prime time.
- You can now request PNG thumbnails, in addition to JPG thumbnails, via the
- Better error handling for badly formatted image files. Rather than returning a generic “question mark” image when we can’t find a thumbnail or an image, you’ll receive a proper error code.
- A ZIP file of Dropbox icons is now provided for your use.