Subscribe to receive notifications of new posts:

Announcing Cloudflare Images beta to simplify your image pipeline

2021-04-20

4 min read
Announcing Cloudflare Images beta to simplify your image pipeline

Today, we are announcing the beta of Cloudflare Images: a simple service to store, resize, optimize, and deliver images at scale.

In 2018, we launched Stream to provide a single product that could be used to store, encode, and deliver videos. With Cloudflare Images, we are doing for images what Stream did for videos. Just like Stream, Cloudflare Images eliminates the need to think about storage buckets, egress costs, and many other common problems that are solved for you out of the box. Whether you are building an ecommerce platform with millions of high-res product pictures and videos or a new app for creators, you can build your entire media pipeline by combining Cloudflare Images and Stream.

Fundamental questions for storing and serving images

Any time you are building infrastructure for image storage and processing, there are four fundamental questions you must answer:

  1. “Where do we store images?”

  2. “How do we secure, resize, and optimize the images for different use cases?”

  3. “How do we serve the images to our users reliably?”

  4. “How do we do all of these things at scale while having predictable and affordable pricing, especially during spikes?”

Cloudflare Images has a straightforward set of APIs and simple pricing structure that answers all of these pesky questions. We built Images so your team can spend less energy maintaining infrastructure and more time focusing on what makes your product truly special.

Current state of image infrastructure

We talked to many Cloudflare customers who are using Cloudflare to serve millions of images every day. We heard two recurring themes. First, customers wished there was a simpler way for them to securely store, resize, and serve the images. Their current infrastructure generally involves using product A for storage, product B for resizing, and product C for the actual delivery. Combining these products together (often from multiple vendors) quickly becomes messy with multiple points of failure. Moreover, maintaining this infrastructure requires ongoing monitoring and tweaks.

Second, we heard that customers often end up with an ever-growing egress bill due to multiple vendors and products. It blew our minds that the egress bill can be a multiple of the storage cost itself. Every time your pictures move from product A (storage provider) to product B (resizing service) to product C (the CDN), you generally pay an egress cost which can quickly add up depending on the number of pictures and their variants. Multiplied by tens of millions of images and variants, this cost can add up to tens of thousands of dollars per month.

Why Cloudflare Images

Eliminate egress cost and storage bucket hell

Each time you upload an image to Cloudflare Images, you receive an :image_id. There are no buckets and folders to manage the originals and the variants. And because of Images built-in support for resizing and delivery, there is no egress cost. If you have internal metadata that you’d like to associate with a picture, you can set the meta field for every upload to any arbitrary JSON value.

Simple APIs catered to your needs

When talking to customers we saw two main patterns of how customers would like to deliver images:

  1. Upload an image and get an :image_uid back that allows future operations on the image. In this case, the image URL would be https://imagedelivery.net/small-thumbnail/:image_uid

  2. Upload images with the filename as their main identifier, e.g. filename reflects SKU.In this case, it is up to you to make sure there are no duplicate filenames, as they would be rejected.

Here the image URL would be https://imagedelivery.net/small-thumbnail/:account_hash/:filename

Resize and secure your pictures with Variants

Cloudflare Images supports Variants. When you create a variant, you can define properties including variant name, width, height, and whether the variant should be publicly accessible. You can then associate an image with one or more variants using the UI or the API.

Let’s say you are storing user profile pictures. You could define a variant called “profile-thumbnail” and configure that variant to serve images of a fixed width and height. Once you have a variant, you can associate the profile pictures with the profile-thumbnail variant. Whenever you need to display a profile picture in your app, you simply call https://imagedelivery.net/profile-thumbnail/:image_uid or https://imagedelivery.net/profile-thumbnail/:account_hash/:filename.

Variants also offer access control. You might only want logged-in users to view the larger version of the profile pictures. You could create another variant called large-profile-picture and make it require a signed URL token. When a user tries to access the large profile picture with a URL such as https://imagedelivery.net/large-profile-picture/:image_uid, the request will fail because there is no valid token provided.

An indirect upside of using variants is that your organization has a single source of truth for the different ways you are using images across your apps. Different teams can create variants for their use cases, enabling you to audit the security and optimization settings for different types of pictures from one central place. We learned that as our customers' products grow in complexity, separate teams may be responsible for handling various aspects of the product. For example, one team may be responsible for user profile pictures and the different variants associated with it. Another team may be responsible for creator uploads and maintaining different variations that are available to the public and to paid members. Over time, organizations can lose track of this logic with no single source of truth. With variants, this logic is clearly laid out and can serve as the source of truth for all the ways you are securing and optimizing different types of image uploads in your product.

There is no additional cost for using variants. Every picture uploaded to Images can be associated with up to five variants. You will be able to associate an image with a variant using the UI or the API.

Intelligent delivery for every device and use case

Cloudflare Images automatically serves the most optimized version of the image. You no longer need to worry about things like file extensions. When a client requests a picture hosted on Cloudflare Images, we automatically identify the ideal supported format at the Cloudflare edge and serve it to the client from the edge. For example, 93.55% of all users use a web browser that supports webp. For those users, Images would automatically serve webp images. To the remaining users, Images would serve PNGs (and in very rare cases where neither webp or PNGs are supported, it would serve JPGs). In future, we plan to automatically support AVIF for highly-requested images.

When you use Images, you no longer need to worry about cache hit rates, image file types, configuring origins for your image assets.

Simple pricing

To use Cloudflare Images, you will pay a fixed monthly fee for every 100,000 images stored in Cloudflare Images (up to 10MB per image). And at the end of each month, you pay for the number of images served. There are no additional costs for resizing, egress, or optimized routing.

Request an Invite

If you want to be part of Cloudflare Images beta, request an invite. We will start inviting a limited set of users to try out Cloudflare Images in the coming weeks. Pricing and developer docs for Images will be posted at the time we start sending invites.

We can’t wait to see what you build using Cloudflare Images!

Cloudflare's connectivity cloud protects entire corporate networks, helps customers build Internet-scale applications efficiently, accelerates any website or Internet application, wards off DDoS attacks, keeps hackers at bay, and can help you on your journey to Zero Trust.

Visit 1.1.1.1 from any device to get started with our free app that makes your Internet faster and safer.

To learn more about our mission to help build a better Internet, start here. If you're looking for a new career direction, check out our open positions.
Developer WeekDevelopersCloudflare ImagesProduct News

Follow on X

Zaid Farooqui|@zaid
Marc Lamik|@marclamik
Cloudflare|@cloudflare

Related posts

October 24, 2024 1:00 PM

Durable Objects aren't just durable, they're fast: a 10x speedup for Cloudflare Queues

Learn how we built Cloudflare Queues using our own Developer Platform and how it evolved to a geographically-distributed, horizontally-scalable architecture built on Durable Objects. Our new architecture supports over 10x more throughput and over 3x lower latency compared to the previous version....

October 09, 2024 1:00 PM

Improving platform resilience at Cloudflare through automation

We realized that we need a way to automatically heal our platform from an operations perspective, and designed and built a workflow orchestration platform to provide these self-healing capabilities across our global network. We explore how this has helped us to reduce the impact on our customers due to operational issues, and the rich variety of similar problems it has empowered us to solve....