Serverless Image Gallery with CDN Delivery

10 minutes to integrate

Fotorama is a simple yet powerful image gallery. It supports any browsers, provides seamless responsive experience and lazy loading images. By bringing Uploadcare together, you can get your galleries serverless and powered up with best-in-class CDN delivery.

By serving images from Uploadcare, you also enable our Image Transformations engine for your images.

Here’s what you’ll get,

This guide will help you learn how to build a serverless image gallery and apply Image Transformations with a few lines of HTML. It should take you about 10 minutes.

Step 1. Get Uploadcare Account

First, you will need an Uploadcare account. In case you don’t have it, Sign Up for one, it’s free. Then, navigate to your dashboard, go to an existing project or create a new one.

Step 2. Upload Images

Switch to “Files” in the sidebar. Hit “Upload new files” and choose images you want to include in your gallery. We recommend continuing with about four uploaded images.

Once uploaded, your images will appear on the list of files in your project. Click any file and see how its URL now looks like:

Once your images are on Uploadcare, we store them for you. From here, you can manipulate images via their permanent URLs. Let’s elaborate on the URL components.

First, the part indicates an image has already been cached by our CDN layers. Then, :uuid is a unique identifier assigned to your image, and :filename holds its original filename. We won’t need :filename any longer: your image is now addressable via UUID, i.e., this will work:

We’ll need your new image links to complete further steps of this guide, let’s move on to adding Fotorama to your page.

Step 3. Add Fotorama

Getting Fotorama up and running involves adding some HTML.

This goes to the <head> of your page:

<!-- Add jQuery 1.8 or later to your page, 33 KB -->
<script src=""></script>

<!-- Get Fotorama from CDNJS, 19 KB -->
<link href="" rel="stylesheet">
<script src=""></script>html

Then, add the <div> element with the specified fotorama class to the block of your page where you want the gallery and define image URLs:

Your gallery will now include four images, however you may notice the images are too heavy and have different aspect ratios. We can fix this by adding some Image Transformations.

Step 4. Add Image Transformations

You can modify any image on the fly by simply modifying its URL. We’ll implement the -/crop/ and -/preview/ transformations to handle image aspect ratios and sizes:

Then, we’d want the gallery to be responsive and allow it to enter the fullscreen mode. That’s done by specifying a couple of data attributes:

<div class="fotorama"
  <img src=",0/-/preview/">
  <img src=",2807/-/preview/">
  <img src=",0/-/preview/">
  <img src=",3360/-/preview/">

Note, Fotorama provides two ways of handling the fullscreen mode, check out the “Fullscreen” section in their docs. Getting the image gallery responsive is a way to handle its “Dimensions,” see this Fotorama docs article for fine-tuning.

Your gallery is now there and ready.

In case you want the gallery to contain image thumbnails rather than the full-sized originals, you can modify the <div> contents in the following manner:

Note how we modified the -/preview/ Image Transformation parameters: the image was thus resized to fit in the 128x128px box without changing its original aspect ratio.

You can learn more about existing Image Transformations in our docs. Specifically, the section about Filters.


That’s it, you’ve just added a serverless image gallery to your page. It serves content from CDN and allows manipulating images on the fly 🚀

From here, you can move on to some further reading:

Should you have any questions, feel free to post those around our community area.