Images
When you upload an image, Bubble doesn't modify the original file. No resizing, compressing, or altering happens during upload, and the original is stored exactly as you uploaded it.
For performance, though, Bubble automatically generates optimized copies of the image when it's displayed. These are created at run time and cached.
Image caching
While Bubble doesn't modify your original image, it uses a CDN transformation layer to render images dynamically in your app.
This transformation applies specifically to images shown in image elements or as backgrounds, under these conditions:
Public images
The image isn't attached to a private Bubble thing.
Bubble storage
The image is stored in Bubble's file storage.
File type
SVG files aren't compressed, since they're vector-based and scale without losing quality.
When displaying an image, Bubble's run-mode engine works out the optimal size and compression based on the container or device resolution. It uses the transformation layer to create a temporary resized or compressed copy of the original.
Each time the image is rendered in a new context, a differently sized container or a device with a different resolution, a new copy is generated on the fly. For example:
The same image shown as a small icon and as a full-width banner produces two differently resized versions.
High-resolution devices may trigger higher-quality copies than standard-resolution ones.
These transformations keep loading efficient and display quality high across different devices and layouts.
Copies made through the transformation layer are stored temporarily in Bubble's cache for up to 30 days. This caching applies even if you delete the original image during that period, so the transformed versions can still be accessed for up to 30 days after deletion.
Cached copies don't count toward your storage limit, since they're managed within Bubble's performance infrastructure. If a cached version isn't available, Bubble generates a new resized copy from the original so the image always displays correctly.
Managing images in the Bubble editor
Uploading images in the editor
Files uploaded through the Bubble editor aren't protected by privacy rules. Only upload files that are meant to be public.
You can upload images directly in the editor in two ways.
File manager
Go to the Data tab, in the File manager section, to see and search all uploaded files. To upload one, click Upload in the upper-right corner.

The database editor
When you edit a database thing that has an image field, you can upload a file directly to that field. Bubble uploads the file and links its URL to the thing.
Deleting files in the editor
To delete image files in the editor, go to the Data tab, in the File manager section. Select the files you want to delete using the checkboxes in the list, then click Delete in the upper-right corner. Keep in mind that Development and Live are separate.
If you edit a database thing and remove a file from it with the Clear link, this only removes the URL saved on that thing. It does not delete the file.

Managing images in a web app
Uploading images
To upload an image, use the Picture uploader element. When the user clicks the element, the OS file opener dialog opens and lets the user selects which image to upload.
As soon as a user uploads a file, it's sent to the file storage server and has a live URL that anyone with the link can view, even before you've saved that URL to the database. To keep files private, see using privacy rules with files below.
Saving the URL in the database
Once an image is uploaded through one of the elements, the element's value returns the image's URL. You then use a workflow to save that URL to an image field on the relevant data type.

Uploading private images
Private images are linked to a specific database record and inherit the privacy rules of that data type. For example, if a user uploads a cover image to their blog post, the image file is protected according to the privacy rules set on the Post data type.
Keeping a file private takes a few settings, in two places: the uploader element and the data type's privacy rules.
Attach it to a thing
A dynamic field appears where you specify which database thing to attach the file to. In this example, we've set it to the Current page's Post.
Attaching the image file to a thing is what ties its privacy to that record. Once a file is attached, it inherits the privacy rules of that thing's data type. If you attach a private file to a post, the post's privacy rules now govern the file too: the View attached files permission on the Post data type decides who's allowed to see it. Without attaching the file to a thing, there's no record for it to inherit rules from, which is why this step is what makes a private upload actually private.

Check the privacy rules
Marking the file private on the element isn't enough on its own. It binds the file to the thing, but the thing's privacy rules are what actually control access. Go to the Post data type's privacy rules and make sure View attached files is unchecked for anyone who shouldn't see the file. This is the setting that keeps the file itself out of reach, even from someone who somehow gets hold of its URL.

Should I compress images before uploading?
Compressing and resizing images before upload is generally unnecessary for performance, since Bubble automatically optimizes images for display through its CDN caching and transformation process.
If saving storage space is a priority, though, resizing and compressing images to the size they'll most often be displayed at can help. When you do, make sure the images are still large enough for screens bigger than your own. For example, if you're testing a background image on a Full HD monitor, a higher-resolution image may be needed to keep it sharp for users on 4K monitors.
For apps where image quality is crucial, we recommend uploading images at the maximum resolution they'll be viewed at. This gives the best experience for everyone, whatever their screen size.
Managing user-uploaded images
When users upload images, you may lose control over the initial file size, which can lead to more storage use than you intended. Since Bubble doesn't include native image processing, you can address this in one of two ways.
Set a maximum file size
You can configure the picture uploader element to enforce a maximum file size. This pushes users to reduce their file size before uploading, helping you keep control of your storage.
Use a plugin
Plugins can offer features like image compression before upload. For the best results, choose a plugin that stores the compressed image in Bubble's file storage, so the image still benefits from Bubble's caching and transformation process.
Compression with the file uploader
Compression and resizing also apply to images uploaded through the file uploader element. They're applied when the image is first loaded, rather than during upload, so the same rules described above apply here too.
Since the file uploader supports a wider range of formats, some files aren't optimized, such as SVGs and animated GIFs. HEIC and HEIF, Apple's image formats, aren't officially supported.
Images uploaded via plugins
Images uploaded through a plugin behave the same as other uploads, as long as they're stored in Bubble's file storage. If a plugin stores the image in an external storage service instead, the caching and transformation process won't happen.
Managing images in a mobile app
Uploading images on iOS/Android
To upload an image in an Android or iOS app, you can use the built-in camera library or the user can take a photo using the built-in camera feature.
An important difference between the web app method and the native mobile method is that web apps rely on an element (picture uploader), while the native mobile method relies on actions.
As soon as a user uploads a file, it's sent to the file storage server and has a live URL that anyone with the link can view, even before you've saved that URL to the database. To keep files private, see using privacy rules with files below.
Uploading images from the camera library
Save the result to the database
Add a Make changes to a thing action after it. On the field where you want to store the image, set the value to Result of step X (the step that ran the camera library), so the uploaded image's URL is saved.
If you're uploading multiple images, make sure the field is set up to hold a list.
Take an image with the device camera and upload it
Saving the URL in the database
Once an image is uploaded through one of the actions, the actions Result of step X value returns the image's URL. You then use a workflow to save that URL to an image field on the relevant data type.

Uploading private images
Private images are linked to a specific database record and inherit the privacy rules of that data type. For example, if a user uploads a cover image to their blog post, the image file is protected according to the privacy rules set on the Post data type.
Keeping a file private takes a few settings, in two places: the Open camera library/Open device camera actions, and the privacy rule connected to that thing.
Attach it to a thing
A dynamic field appears where you specify which database thing to attach the file to. In this example, we've set it to the Parent group's Post.
Attaching the image file to a thing is what ties its privacy to that record. Once a file is attached, it inherits the privacy rules of that thing's data type. If you attach a private file to a post, the post's privacy rules now govern the file too: the View attached files permission on the Post data type decides who's allowed to see it. Without attaching the file to a thing, there's no record for it to inherit rules from, which is why this step is what makes a private upload actually private.

Parent group's Post.Check the privacy rules
Marking the file private on the element isn't enough on its own. It binds the file to the thing, but the thing's privacy rules are what actually control access. Go to the Post data type's privacy rules and make sure View attached files is unchecked for anyone who shouldn't see the file. This is the setting that keeps the file itself out of reach, even from someone who somehow gets hold of its URL.

Deleting uploaded images
Removing the contents of an image field only clears the URL stored on the thing. The file itself stays on the storage server, still accessible to anyone with the link. To delete the file as well, you need to run two actions, and the order matters.
Delete the file
Use the Delete an uploaded file action first. This action needs the file's URL to know which file to remove, so it has to run while the URL is still saved on the thing. If you cleared the field first, the action would have nothing to point to.
Clear the field
Use a Make changes to a thing action to clear the image field that stored the URL. This makes sure you're not left holding a URL that points to a file that no longer exists.
FAQ: Images
Last updated
Was this helpful?

