Introducing Croppie, a plugin to give another element in Bubble.
The element can be put on a page, for the user to choose their own pictures, rotate, zoom, crop, then upload them to Bubble. The image will be cropped to the page designer’s chosen size.
Getting started
- Add the plugin.
-
Add the Croppie element to your page.
-
Add a button to Browse local images, workflow action:
-
Browse a Croppie.
-
Add buttons to Rotate image, workflow action:
-
Rotate a Croppie, choose rotation.
-
Add button to Save cropped image, workflow actions:
-
Create a database record to attach image to (if making file private).
-
Save a Croppie, this will initiate an image upload to storage (S3).
-
Add a workflow event for Croppie is saved, workflow action:
-
Make changes to a database record, set Image = This Croppie’s image.
-
Set the properties on the Croppie element.
Sample page, editor and runtime.
Some features
-
Crop will match Viewport width and height in pixels.
-
Viewport can be
square
orcircle
, meaning rectangle or oval. -
Boundary is an option to use only part of the Croppie container for cropping. It can be set in pixels, or in percentage of the container. Boundary is handy to leave room for the zoomer control.
-
Zoomer is an optional slider control inside the Croppie element.
-
There is a Zoom workflow action if you want to provide your own zoom controls.
-
EXIF turned on allows Croppie to find the correct orientation of the image, if set.
-
Custom class can be entered, to allow you to add your own styles, for example on the page html header.
-
Output format can be configured.
-
auto
will set the output to jpeg if the input is jpeg, and png otherwise. -
png
is best to allow transparency, particularly for a circle viewport. -
jpeg
output will have black corners for a circle viewport. -
Resulting file can be set as
private
, similar to the Picture Uploader control. Attach to an existing database record for the setting to be applied. -
The Croppie javascript library will only be loaded on a page that has the Croppie element.
Background
-
During the development of this plugin, a few bugs in the plugin platform were found, which were promptly fixed by the Bubble team, thank you @emmanuel!
-
The javascript library used is open source, and documentation is here:
Croppie - a simple javascript image cropper - Foliotek -
We have had some fun discussion on this topic:
Support for outputing standard sizing / cropping of user submitted images
I hope this is useful, and please comment here