Build a photo editing tool in Bubble by embedding a JavaScript image editor library like Pintura or Toast UI Image Editor inside an HTML element. Users can crop, resize, apply filters, and save the edited image back to Bubble's file storage. This tutorial covers the full integration from library setup to saving results.
Overview: Photo Editing in Bubble
Bubble does not include a native image editor, but you can embed a full-featured one using an HTML element and a JavaScript library. This tutorial shows non-technical builders how to add crop, resize, and filter functionality using the free Toast UI Image Editor, connecting it to Bubble's file system through the JavaScript-to-Bubble bridge.
Prerequisites
- A Bubble account with an app
- The Toolbox plugin installed (for JavaScript-to-Bubble communication)
- An image upload feature already in place
- Basic understanding of HTML elements in Bubble
Step-by-step guide
Install the Toolbox plugin for JavaScript bridge
Install the Toolbox plugin for JavaScript bridge
Go to the Plugins tab and click 'Add plugins.' Search for 'Toolbox' and install it. This plugin provides the 'Run JavaScript' action and 'JavaScript to Bubble' element that lets your HTML code send data back to Bubble workflows. Without this, you cannot save edited images back to your database.
Expected result: The Toolbox plugin is installed and available in your element palette and workflow actions.
Add a File Uploader and image display
Add a File Uploader and image display
On your photo editing page, add a File Uploader element for users to select an image. Below it, add an Image element with its source set to 'File Uploader's value.' Add a Button labeled 'Edit This Photo.' This gives users a preview of their uploaded image before they enter the editor.
Expected result: Users can upload an image, see a preview, and click a button to start editing.
Add the HTML element with the image editor library
Add the HTML element with the image editor library
Drag an HTML element onto the page and make it large (at least 800x600px). Double-click it and paste the code that loads the Toast UI Image Editor from a CDN and initializes it. The editor provides crop, rotate, flip, draw, text, filter, and resize tools. Set the initial image source to a placeholder — you will update it dynamically in the next step.
1<link rel="stylesheet" href="https://uicdn.toast.com/tui-image-editor/latest/tui-image-editor.css">2<script src="https://uicdn.toast.com/tui-image-editor/latest/tui-image-editor.js"></script>3<div id="tui-image-editor" style="width:100%;height:600px;"></div>4<script>5 var editor = new tui.ImageEditor('#tui-image-editor', {6 includeUI: {7 loadImage: {8 path: '',9 name: 'Uploaded Image'10 },11 theme: {},12 menuBarPosition: 'bottom'13 },14 cssMaxWidth: 800,15 cssMaxHeight: 60016 });1718 window.loadImageToEditor = function(url) {19 editor.loadImageFromURL(url, 'Uploaded Image').then(function() {20 editor.clearUndoStack();21 });22 };2324 window.getEditedImage = function() {25 return editor.toDataURL();26 };27</script>Expected result: The HTML element displays a full image editor interface with toolbar and canvas.
Load the uploaded image into the editor
Load the uploaded image into the editor
On the 'Edit This Photo' button workflow, add an action: Run JavaScript (from the Toolbox plugin). In the script field, enter: window.loadImageToEditor('File Uploader's value's URL'). Use the dynamic data inserter to reference the File Uploader's value. This sends the uploaded image URL to the JavaScript editor.
Pro tip: Make sure the image URL is publicly accessible. Bubble-hosted images are public by default unless you have privacy rules on the file field.
Expected result: Clicking 'Edit This Photo' loads the uploaded image into the Toast UI editor for editing.
Save the edited image back to Bubble
Save the edited image back to Bubble
Add a 'JavaScript to Bubble' element from the Toolbox plugin (it is invisible). Set its bubble_fn_suffix to 'edited_image' and value type to 'text.' Add a Button labeled 'Save Edited Photo.' Its workflow: Run JavaScript → script: var dataUrl = window.getEditedImage(); bubble_fn_edited_image(dataUrl); This sends the base64 image data to Bubble. Then add a second action that uses a backend workflow or the 'Upload data as file' plugin action to convert the base64 data to an actual file and save it to the current user or a database record.
Expected result: The edited image is saved as a file in Bubble's storage and linked to the appropriate database record.
Complete working example
1PHOTO EDITING TOOL — WORKFLOW SUMMARY2======================================34PLUGINS REQUIRED:5 - Toolbox (for Run JavaScript + JavaScript to Bubble)67PAGE ELEMENTS:8 - File Uploader (for selecting image)9 - Image element (preview, source = File Uploader's value)10 - Button: "Edit This Photo"11 - HTML Element (800x600px, contains Toast UI Image Editor)12 - JavaScript to Bubble element (suffix: edited_image, type: text)13 - Button: "Save Edited Photo"1415WORKFLOW 1: Load Image into Editor16 Event: When "Edit This Photo" is clicked17 Action: Run JavaScript18 Script: window.loadImageToEditor('[File Uploader value URL]')1920WORKFLOW 2: Save Edited Image21 Event: When "Save Edited Photo" is clicked22 Action 1: Run JavaScript23 Script: var dataUrl = window.getEditedImage();24 bubble_fn_edited_image(dataUrl);25 Action 2: Upload data as file (base64 → file)26 Action 3: Make changes to thing → set image field = uploaded file2728EDITOR FEATURES AVAILABLE:29 - Crop (freeform and fixed ratios)30 - Rotate (90° increments and freeform)31 - Flip (horizontal/vertical)32 - Draw (brush tool)33 - Add text34 - Apply filters (grayscale, sepia, blur, etc.)35 - ResizeCommon mistakes when creating a photo-editing tool in Bubble.io: Step-by-Step Guide
Why it's a problem: Forgetting to install the Toolbox plugin
How to avoid: Install the Toolbox plugin from the Plugins tab before starting this tutorial
Why it's a problem: Using a private image URL that the editor cannot access
How to avoid: Ensure the image file field does not have privacy rules blocking public access, or use a signed URL
Why it's a problem: Not handling large image files that slow down the editor
How to avoid: Add file size validation on the File Uploader (max 5MB) and compress images before editing
Best practices
- Set a maximum file size on the File Uploader to prevent oversized images from crashing the editor
- Use the Toolbox plugin's JavaScript to Bubble element for reliable data transfer between JS and Bubble
- Compress saved images server-side using a backend workflow before storing them
- Provide a loading indicator while the editor initializes — large libraries take a moment to load
- Store both the original and edited versions of images for undo capability
- Test the editor on mobile devices — touch interactions may need additional CSS adjustments
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I want to add a photo editing feature to my Bubble.io app where users can crop, resize, and apply filters to uploaded images. Can you help me integrate a JavaScript image editor library into an HTML element and save the edited image back to Bubble's database?
Add a photo editing feature to this page. Embed an image editor in an HTML element where users can crop, resize, rotate, and apply filters. Connect it to the File Uploader so the uploaded image loads into the editor, and save the edited result back to the database.
Frequently asked questions
Is the Toast UI Image Editor free to use?
Yes. Toast UI Image Editor is open-source under the MIT license. It is free for both personal and commercial use.
Can I use a different image editor library?
Yes. Alternatives include Pintura (paid, more polished), Cropper.js (crop-only, lightweight), and Fabric.js (canvas-based, more customizable). The integration pattern is the same — embed via HTML element and bridge with Toolbox.
Will the editor work on mobile devices?
The Toast UI editor has basic mobile support, but the toolbar can be cramped on small screens. Consider hiding the editor on mobile and showing a simplified crop-only interface instead.
How do I save the edited image to a specific user's profile?
After receiving the base64 data via JavaScript to Bubble, use a Make changes to Current User action to set their profile_image field to the uploaded file result.
What image formats does the editor support?
The editor can load and export JPEG, PNG, and SVG. The toDataURL function defaults to PNG. Add a format parameter to export as JPEG for smaller file sizes.
Can RapidDev build a custom photo editing feature for my app?
Yes. RapidDev can integrate advanced image editing capabilities with custom filters, watermarking, and batch processing tailored to your specific needs.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation