Unlayer Examples
Documentation

User Uploads

In this example, we will show user uploaded images from your database in the Unlayer Uploads tab.

You can see full documentation on this feature.


Initialize Editor

We'll initialize the editor. Make sure to provide a unique user id in the user object.

unlayer.init({
  id: 'editor',
  displayMode: 'email',
  user: {
    id: 1,
  },
});

Load User Uploads

Next, we'll use our data provider api to load user uploaded images. You can see full documentation to learn more on the attributes.

unlayer.registerProvider('userUploads', function (params, done) {
  const page = params.page || 1;
  const perPage = params.perPage || 20;
  const total = 100;
  const hasMore = total > page * perPage;

  // Load images from your database here...
  const images = [];

  done(images, { hasMore, page, perPage, total });
});

Live Demo

Here's a live preview of the user uploads. Click the Uploads tab to try it.