惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Heimdal Security Blog
A
Arctic Wolf
K
Kaspersky official blog
V
Vulnerabilities – Threatpost
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Simon Willison's Weblog
Simon Willison's Weblog
L
LINUX DO - 热门话题
MongoDB | Blog
MongoDB | Blog
T
Threat Research - Cisco Blogs
D
Docker
爱范儿
爱范儿
T
Tenable Blog
C
Check Point Blog
B
Blog
C
Cisco Blogs
Vercel News
Vercel News
The Cloudflare Blog
T
Threatpost
NISL@THU
NISL@THU
T
Tor Project blog
V2EX - 技术
V2EX - 技术
P
Palo Alto Networks Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Tailwind CSS Blog
G
GRAHAM CLULEY
P
Privacy & Cybersecurity Law Blog
SecWiki News
SecWiki News
博客园 - 司徒正美
S
Security @ Cisco Blogs
GbyAI
GbyAI
S
Secure Thoughts
Microsoft Security Blog
Microsoft Security Blog
The Register - Security
The Register - Security
Recorded Future
Recorded Future
Cloudbric
Cloudbric
Webroot Blog
Webroot Blog
N
News and Events Feed by Topic
Y
Y Combinator Blog
博客园_首页
T
Troy Hunt's Blog
The Hacker News
The Hacker News
雷峰网
雷峰网
Google DeepMind News
Google DeepMind News
U
Unit 42
AWS News Blog
AWS News Blog
PCI Perspectives
PCI Perspectives
V
Visual Studio Blog
博客园 - 聂微东
有赞技术团队
有赞技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell

ImageKit.io Blog

Next.js Image Optimization with ImageKit Use Video as a Background in Your Next.js Project How to Fix Autoplay Video in Next.js How Durian Scaled a Visual-First Retail Experience to 350K Monthly Visitors Online How Matsmart accelerated image delivery across countries with ImageKit AI in Digital Asset Management: From Smart Workflows to Agentic Automation How Joseph Joseph unified and secured global video delivery with ImageKit How Modall powers fast, effortless media delivery across 40+ projects with ImageKit Digital Asset Management (DAM) Trends: 2026 Report How to add a poster image to Video.js player (and automate it) HLS streaming with Video.js + React Building the future of storytelling with fast, AI-powered video delivery How PushOwl delivers 100M+ image-rich notifications seamlessly with ImageKit How Homify delivers millions of interior design images seamlessly with ImageKit Better event discovery with lightning‑fast videos & images Adding video player in React Native Video player in Angular applications Crop and resize videos in React Next.js image and video upload React image and video upload React video optimization How we quadrupled our traffic to 625K monthly page views How Apollo 24|7 boosted performance & reduced costs with ImageKit Simplify your media workflows with ImageKit DAM integrations Extending Lighthouse for custom image and video optimization analysis Brand Asset Management: What is it? How does it work? WordPress Digital Asset Management Guide - Manage your WP media assets better Why Shopify retailers need a digital asset management solution DAM vs. SharePoint: Which is best for you? AI-powered Metadata and Tagging in Digital Asset Management How Hopscotch built India's largest online Kids' fashion brand with ImageKit Dropbox Vs. DAM: Which Is The Right Tool For Digital Asset Management Digital Asset Management for Photographers: A Complete Guide Why digital asset management for agencies is essential Helping both Top and Bottom Line: SaffronStays rapid, profitable growth with ImageKit How KreditBee simplified media experiences with ImageKit Google Drive alternatives for businesses (with fast-growing teams) Node.js image upload ImageKit: The Secret Ingredient in Swiggy’s Expansion Journey Streamlining the Design Approval Process: A Comprehensive Guide AV1 Codec - Complete guide for video application devs PHP image and video upload Angular image & video upload AV1 vs VP9: Which codec should you choose? Adding video player in Next.js React Video Player VP8 vs VP9 - In the context of online video delivery Exploring WebM vs MP4 7 Free Digital Asset Management Software that are not Open-Source Comparing 9 Top Digital Asset Management Tools in the Market What are Brand Standards and Why do they Matter? Boost Sales and Brand Appeal: Essential Tips for eCommerce Image Management Brand Recall: The Strategy to Create Unforgettable Brands How to upload files in HTML? Branding for Small Businesses (2025 Edition) Everything you need to know about VP9 codec Recent updates from ImageKit and what's next Best Ways to Write RFP For Digital Asset Management (+ with free RFP template) What is Brand Dilution? How to Avoid It? Explained with [Examples] The Importance of Brand Identity: Leveraging Digital Asset Management for Impact From Launch to Scale: How to Launch a Brand Campaign Digital Asset Management Requirements - What do You Need to Evaluate and How? Marketing Collateral Management: A Quick End-to-End Guide Video Content Management System: What Is It And How To Choose One? Dropbox vs. Google Drive vs. Onedrive: The Best Cloud Storage Solution How to Build Brand Trust: Get Started In 2025 Google Drive vs. Box: A Detailed Comparison How Digital Asset Management Solutions Help Protect Brand Equity A DAM Solution Can Safeguard Your Digital Intellectual Property - Here’s How WebP Vs. PNG: Which Image Format Should You Use and Why? How to Resize Images in Bootstrap Easily Progressive jpegs (PJPEG): the key to loading images faster on your website Dropbox vs. Google Drive: The Best Cloud Storage For Digital Assets Dropbox Pros & Cons In 2024: An In-Depth Analysis and Why A DAM Solution Stands Out Google Drive Vs OneDrive: The Better Storage Option For Digital Assets Manage your video assets better with video metadata Understanding DAM's Role in Strengthening Brand Identity Digital asset management strategy: What to know before creating one The Ultimate Guide To Marketing Agency Onboarding 6 Solutions To Simplify Large File Sharing Over The Web A Step-by-Step Breakdown of a Video Production Workflow 13 Digital Asset Management Use Cases You Should Know How to Conduct a Brand Audit and Manage Your Brand Assets Costly Consequences of Inconsistent Branding And How DAM Can Help Dynamic Asset Transformation: What It Is, Why You Need It, and How ImageKit Can Help Everything You Need to Know About HTML Video Autoplay How To Select Your DAM Vendor: A Complete Guide How to Boost User Experience with Smart Digital Asset Management React Image Optimization: A Guide for Web Developers Why Should DAM Be A Part Of Your MarTech Stack? Unleashing the Power of Content Repurposing with ImageKit MKV vs MP4: Which Video File Format Is Better for Your Needs? Digital Asset Management For Ecommerce: A Complete Guide How an Image Tagging Software can Transform Your Image Search How to Manage Your Content Lifecycle Effectively M4V vs MP4: Which Video Format Should You Use and Why? Why Every Business Needs An Image Management System All The Questions To Ask During A Dam Demo Which is the Best Image Format for Your Website? Uploading Multiple Files Using JavaScript: A Comprehensive Guide
Optimize and resize images in Firebase storage using ImageKit
Rahul Nanwani · 2021-07-30 · via ImageKit.io Blog

Firebase is Google's flagship app development platform that provides tools to develop and run mobile apps. From development to analytics to crash reporting and running marketing experiments, the Firebase platform consists of several products.

One of these products is the Firebase Cloud Storage which provides an easy way for Firebase users to store the images and videos from their apps onto the cloud.

While the cloud storage offering is very robust and makes it simple to upload and store media in the cloud, it has certain limitations regarding image delivery. For example, it does not provide image optimization features like format conversion to WebP or image compression. One cannot resize or crop the images stored in Firebase storage in real-time to deliver correctly-sized images to every device.

These limitations, coupled with the ever-increasing number of user devices, make it challenging to deliver fast, optimized experiences in your app.

An image in Firebase storage that we will optimize.
An image in Firebase storage that we will optimize.

There are different ways available to optimize and transform images in Firebase storage. Some plugins create fixed sizes of images and store them back in your storage. Some methods require you to set up your own real-time image transformation service on Firebase and manage it as well.

With all the app development already in your pipeline, this might not be the best use of your time.

That's where a solution like ImageKit comes in. It integrates directly with your Firebase Cloud Storage and can deliver optimized and resized images across devices with minimal effort. You can get started for free on the Forever Free plan on ImageKit!

Read on to see how you can do this.

What is ImageKit?

ImageKit is a cloud-based end-to-end image management and delivery service. It comes with in-built storage and delivery CDN (AWS CloudFront), with automatic optimizations and more than 50 image and video transformations that can be performed in real-time.

The good thing about ImageKit is that you can use all its optimization and transformation features while storing the original images in your Firebase Cloud Storage.

This means you don't have to make any significant changes to your image upload and storage workflow and can still deliver optimized images to your users.

Over 35,000 developers and 600 companies use ImageKit to deliver billions of optimized images and videos every day.

Let's look at how you can use it with your Firebase storage.

Request flow for optimized images in Firebase Storage with ImageKit

  1. After attaching your Firebase Storage to ImageKit, you can access the image in it using the ImageKit URL endpoint.

  2. If ImageKit has a cached version of the image on its CDN or other internal caches, it delivers the image from there. Such images get delivered in low double-digit milliseconds.

  3. Suppose ImageKit does not have the optimized and transformed image in its cache. In that case, ImageKit gets the original image from the storage attached to ImageKit, does all the processing in real-time, and sends back the right image to the user. This takes about 100-200ms on average, depending on the input image.

  4. Subsequent requests for the same image get served from ImageKit's CDN (or if you are using a custom CDN).

The request workflow with ImageKit and the Firebase Storage attached to it
The request workflow with ImageKit and the Firebase Storage attached to it

Integrating Firebase Storage with ImageKit

Let's look at the steps you need to follow to optimize and resize the images in your storage via ImageKit.

Considering the rapidly changing features in both ImageKit and Firebase, always refer to the current technical documentation for this integration here.

We have uploaded some files to our Firebase storage, as shown in the screenshot below.

By the end of this article, we would be able to optimize these images and resize them as per our requirement in real-time.

1. Create an ImageKit Account

The first step is to create an ImageKit account. The Forever Free plan comes with all the image optimization and transformation features, along with 20GB of delivery bandwidth every month. While this is sufficient for most small apps, you can always go for higher plans if your delivery bandwidth requirement is higher.

ImageKit offers seven processing regions across the globe for optimization. You should choose the one that is geographically closest to your storage location.

2. Attaching the Firebase Storage to ImageKit

The next step is to attach the Firebase cloud storage to ImageKit. This will allow ImageKit to access the original images from your storage when needed.

Let's first look at the integration steps and then discuss how private image access works with ImageKit and Firebase.

Adding the Firebase storage as an origin

Go to the “External Storage” page in the ImageKit dashboard and click on the “Add New Origin” button. In the modal that opens up, select the “Origin Type" as “Web Folder”.

Give this origin a name. Then, add your Firebase storage's URL endpoint as the base URL. This would be in the format https://firebasestorage.googleapis.com/*/{project_id.appspot.com}. In our case, as shown in the screenshot below, the base URL will be (masked intentionally)

https://firebasestorage.googleapis.com/v0/b/test-firebase-projXXXXXX.appspot.com

Once you have filled in the base URL, save the origin.

ImageKit does not start copying the objects from your storage after this step. ImageKit accesses an image only when you request it via its ImageKit URL.

Now head over to the “URL Endpoints” section in the ImageKit dashboard. Your newly added Firebase Storage origin will appear under the Default URL Endpoint. If not, you can always click on Edit URL Endpoint, and add this origin to your ImageKit URL Endpoint.

That's it! The setup is now complete. But, let's take some time to understand how this works for private images in Firebase storage.

How private image access will work in Firebase

Private image files in Firebase have additional query parameters like alt=media and token=[ACCESS_TOKEN] in their URL. These would still be required in the URL that we construct with ImageKit.

Since these parameters are not something that ImageKit needs for processing, it passes them to your Firebase storage origin.

Your original images stored in Firebase are private, and that does not change when using ImageKit. Internally, ImageKit is still making a request to your Firebase origin with the alt and token parameters.

Altering the token or not passing it in the ImageKit URL would prevent access to the image, just how it would happen with a standard Firebase URL.

Let's understand this with an actual URL in the next section.

Accessing your Firebase storage files via ImageKit

We need to replace the part of the URL that we added as the Base URL in our Firebase origin in ImageKit, with the ImageKit URL endpoint to which we mapped this origin. So, if our original image URL in Firebase is this (masked intentionally),

https://firebasestorage.googleapis.com/v0/b/test-firebase-projXXXXXX.appspot.com/o/product-clothes-3.jpg?alt=media&token=df8b1026-8c70-459d-87b3-1caa9f1d6d44

The Firebase Storage image URL from our bucket

then, its ImageKit URL is

https://ik.imagekit.io/ikmedia/o/product-clothes-3.jpg?alt=media&token=df8b1026-8c70-459d-87b3-1caa9f1d6d44

URL using ImageKit URL endpoint

The part after our storage's base URL, including the alt and token parameters remain the same with ImageKit.

We need to do the same thing for an image inside a folder in the storage. For example, if the original image URL of an image inside the watches the folder is this (masked intentionally)

https://firebasestorage.googleapis.com/v0/b/test-firebase-projXXXXXX.appspot.com/o/watches%2Fproduct-watch-1.jpg?alt=media&token=f4c16a56-5e7a-4c2a-b8bf-9b412e544265

then its ImageKit URL is

https://ik.imagekit.io/ikmedia/o/watches%2Fproduct-watch-1.jpg?alt=media&token=f4c16a56-5e7a-4c2a-b8bf-9b412e544265

Automatic image optimization for images in Firebase storage

ImageKit detects the formats supported on the requesting device. If the device supports a newer format like WebP or AVIF, ImageKit automatically converts your images to the best possible format. It also compresses the image using the quality optimization setting in your ImageKit dashboard.

With these automatic optimizations, you can be assured that ImageKit will deliver the right image on every device. And we didn't have to write a single line of code or get into the technical details!

For example, the original image product-clothes-3.jpg in the storage was 2.5MB in size.

An image in Firebase storage that we will optimize.
An image in Firebase storage that we will optimize.

When we access it via ImageKit, the image gets converted to WebP on a supported browser, and the size comes down to 1.2MB. That's more than a 50% reduction in size without making any other change to the URL.

If we convert the image to AVIF (via URL transformation parameters or automatic format conversion in ImageKit), then the output image would be just 641KB in size. This is almost 75% smaller than the original image.

Real-time image resizing and other transformations for Firebase Storage

ImageKit allows us to add transformation parameters directly to the image URL to get the transformed image in real-time.

For Firebase storage integration, your image URL already has two query parameters, alt and token. To transform the image, we add another parameter tr to the URL with the transformation parameters.

For example, if we have to resize the above image to width 300px, we just need to add tr=w-300 as a query parameter in our URL. This is done at the end of the URL below -

https://ik.imagekit.io/ikmedia/o/product-clothes-3.jpg?alt=media&token=df8b1026-8c70-459d-87b3-1caa9f1d6d44&tr=w-300
Image resized to width 300px
Image resized to width 300px

Need a 300 x 400 image? It should not be a problem with ImageKit's resizing parameters.

https://ik.imagekit.io/ikmedia/o/product-clothes-3.jpg?alt=media&token=df8b1026-8c70-459d-87b3-1caa9f1d6d44&tr=w-300,h-400

Like the examples above, ImageKit offers over 50 different transformations. You can perform simple crop and resize as demonstrated above. Or carry out more complex operations on your images like watermarking, smart cropping, object-aware cropping, blurring, background change, etc., in real-time.

We can also adjust our images to the correct DPR value needed on a device. For example, for a device with DPR 2, we can add the transform dpr-2 to the transformation string and get the right image instantly.

https://ik.imagekit.io/ikmedia/o/product-clothes-3.jpg?alt=media&token=df8b1026-8c70-459d-87b3-1caa9f1d6d44&tr=w-300,dpr-2

Using ImageKit's image and text overlay transformations, we can generate dynamic banners and contextual images in real-time.

In the example shown below, we have added ImageKit's logo and the product's price as text on an image of a shoe. This is done using the URL-based transformation parameters. You can see the transformed image URL here.

Transformed Image URL - Link
Transformed Image URL - Link

Here is a video demonstrating some of the transformations available in ImageKit.

Examples of real-time image transformations with ImageKit

Get started with ImageKit now!

This was just a quick overview of how ImageKit integrates with Firebase and how you can use it to deliver the right images to your users. The entire setup takes just a few minutes and delivering images via ImageKit is just a matter of replacing a part of your existing image URL.

ImageKit's Forever Free plan comes with 20GB of output bandwidth every month, absolutely free. You can sign up now and start delivering perfectly optimized images on your Firebase apps.