Cloudinary Blog

How to let your users upload images directly from Facebook, Dropbox and more

By
JavaScript Drag and Drop File Upload Widget UI

As developers of web apps, you often need to let users upload files to your app - mainly images and videos. You want the upload interface you provide to offer an intuitive user experience, including the ability to drag & drop multiple media files, preview thumbnails of selected images and videos, view upload progress indication and more. Since we now all live in the cloud era, chances are that many of your users also store media files in the cloud rather than only locally on hard drives and mobile devices, so the option to pick files from social networks like Facebook, cloud storage services such as Dropbox, photo services like Google Photos and more is a big advantage.

Introducing the new and improved Cloudinary Upload Widget - now allowing your users to interactively select images from their Facebook and Google Photos albums, from their Dropbox accounts or from the results of a Google Image Search.  

By including a small JavaScript library and adding a single JavaScript call, you can embed a complete interactive upload UI experience in your web applications:

Copy to clipboard
<script src="//widget.cloudinary.com/global/all.js" 
        type="text/javascript"></script>

<script type="text/javascript">
  cloudinary.openUploadWidget(
    { 
      cloud_name: 'demo', 
      upload_preset: 'a5vxnzbp', 
      sources: [ 'local', 'url', 'camera', 'image_search', 
                 'facebook', 'dropbox', 'google_photos' ],
      google_api_key: '.....' }, 
    function(error, result) { console.log(error, result) });
</script>

Here's a live example. Click the button below to see the widget in action and try out the different media source tabs.

Upload Images

To see the upload widget in action with all media sources, including the Camera and Dropbox sources that require HTTPS, see the following demo page:

https://demo.cloudinary.com/default

From upload API to complete upload UI

A little bit of history... When Cloudinary's image management service was first introduced back in 2012, it included a cloud-based API for uploading images to the cloud and for delivering those images with dynamic manipulations to match your graphic design. The API was powerful, but only when we added SDKs for popular development frameworks such as Ruby on Rails, PHP and Node.js, did developers find it easy enough to use from their back-end applications.

That wasn't enough either. We wanted to eliminate the need for developers to have a server-side upload infrastructure at all, so we added support for direct upload from the browser using a JavaScript library (jQuery plugin). Then, the web development world moved towards Single-Page Applications (SPAs), so we took it one step further and introduced unsigned direct upload from the browser, thus eliminating the need for a server component at all.

While we focused on API and developer components behind-the-scenes, we continued to listen to our customers, and answered with our first front-end user interface component: the Upload Widget. It's a very customizable UI component that supports drag & drop, camera photo capturing, progress indications, interactive image cropping, media preview thumbnails and a lot more.

And now, we are happy to introduce the next phase of the Upload Widget: enabling your users to upload images from third-party cloud storage services and social networks.

Uploading images from third party sources

When using the JavaScript function to open the widget, you can now select up to 7 different media sources to include as tabs within the upload widget's UI. When users select the Facebook, Dropbox, or Google Photos tab, they are prompted to connect to the relevant account. After a successful connection, they can interactively browse through the image search results, their Facebook albums, an image stream of their Google Photos, or the folders & files in their Dropbox account.

The files selected from the remote media sources are then uploaded directly to your Cloudinary account, and are available for dynamic manipulations to match your graphic design. Furthermore, the files are delivered to your users via CDN URLs, optimized for any device, any browser and in any resolution.

Select files from Google image search results

Create your Google Search API key, select whether to allow users to search the whole web or a narrowed down set of predefined sites, and whether to include copyright protection modes (e.g., only images of wikimedia.org that are free to use commercially). Users can type any search term and then select one or more images from the results.

Upload widget - pick images from Google image search results

Select photos from Facebook albums

You can allow your users to connect to Facebook and browse through their Facebook photos and albums. Users can select multiple photos from Facebook that will be uploaded to your web application, and then be available for further management, delivery and graphic manipulation - such as resizing & cropping.

Upload widget - Connect to Facebook application for photo browsing

Upload widget - pick images from Facebook albums

Note: None of your users' personal information is collected or used by the Media Upload Facebook application.

Select images or videos from Google Photos

Similar to the Facebook media source, you can allow your users to connect to their Google Photos account and browse through all their media files. Selected images can either be uploaded as-is to your Cloudinary account or interactively cropped by your users before uploading.

Upload widget - pick images from Google Photos

Upload widget - Connect to Facebook application for photo browsing

Select files from a Dropbox account

Dropbox accounts can contain any kind of file - not only images - and Cloudinary's upload API and upload widget also support uploading any file type (PDF documents, videos, Office documents, text files, ZIP files, and more). After connecting to their Dropbox account, your users can browse through their Dropbox folders and select one or more files that can then be uploaded to your Cloudinary account and associated with the model of your dynamic web application.

Upload widget - pick files from Dropbox folders

For a full listing of all the JavaScript options and parameters available for the upload widget, take a look at the API reference table on the upload widget's documentation page.

Towards a better image upload user experience

In this article, we have highlighted the new media sources you can use with the upload widget. The widget supports many additional capabilities that you can mix and match: interactive cropping, client-side resizing, look & feel customization and more. Take a look at our documentation for more details.

Spoiler alert! We are already working on the next version of the upload widget, which should be released within the next few months. More media sources, such as additional social networks, cloud storage services and stock photography services will be supported. We are also redesigning the widget with a revamped look & feel, and we are developing the widget to be a centric uploader component for modern web applications.

The upload widget, including support for all-the new media sources described in this post, is available for free for all of Cloudinary's plans. You can create your free account here. We would of course appreciate any feedback you have!

Recent Blog Posts

Our $2B Valuation

By
Blackstone Growth Invests in Cloudinary

When we started our journey in 2012, we were looking to improve our lives as developers by making it easier for us to handle the arduous tasks of handling images and videos in our code. That initial line of developer code has evolved into a full suite of media experience solutions driven by a mission that gradually revealed itself over the course of the past 10 years: help companies unleash the full potential of their media to create the most engaging visual experiences.

Read more
Direct-to-Consumer E-Commerce Requires Compelling Visual Experiences

When brands like you adopt a direct–to-consumer (DTC) e-commerce approach with no involvement of retailers or marketplaces, you gain direct and timely insight into evolving shopping behaviors. Accordingly, you can accommodate shoppers’ preferences by continually adjusting your product offering and interspersing the shopping journey with moments of excitement and intrigue. Opportunities abound for you to cultivate engaging customer relationships.

Read more
Automatically Translating Videos for an International Audience

No matter your business focus—public service, B2B integration, recruitment—multimedia, in particular video, is remarkably effective in communicating with the audience. Before, making video accessible to diverse viewers involved tasks galore, such as eliciting the service of production studios to manually dub, transcribe, and add subtitles. Those operations were costly and slow, especially for globally destined content.

Read more
Cloudinary Helps Minted Manage Its Image-Generation Pipeline at Scale

Shoppers return time and again to Minted’s global online community of independent artists and designers because they know they can count on unique, statement-making products of the highest quality there. Concurrently, the visual imagery on Minted.com must do justice to the designs into which the creators have poured their hearts and souls. For Minted’s VP of Engineering David Lien, “Because we are a premium brand, we need to ensure that every single one of our product images matches the selected configuration exactly. For example, if you pick an 18x24 art print on blue canvas, we will show that exact combination on the hero images in the PDF.”

Read more
Highlights on ImageCon 2021 and a Preview of ImageCon 2022

New year, same trend! Visual media will continue to play a monumental role in driving online conversions. To keep up with visual-experience trends and best practices, Cloudinary holds an annual conference called ImageCon, a one-of-a-kind event that helps attendees create the most engaging visual experiences possible.

Read more