Media - globules-io/OGX.JS GitHub Wiki

Previous methods have been deprecated as of version 1.45.0 and removed from the wiki. Check out your console with the dev build for warnings.

Crop 1.32.0+

The crop method allows you to resize and/or crop a base64 encoded image

OGX.Media.crop(_BASE64_, _CALLBACK_, _WIDTH_, _HEIGHT_, _X_, _Y_);

To resize an image

OGX.Media.crop('ar23ez4a5r...', (__base64) => {...}, 600, 600);

To crop an image to get a square of 100px from position x 50px and y 50px

OGX.Media.crop('ar23ez4a5r...', (__base64) => {...}, 100, 100, 50, 50);

Read 1.45.0+

Convert a media File into a useable url

OGX.Media.read(_FILE_, _CALLBACK_);

Practical example

OGX.Media.read(myFile, (__file, __url) => { ... });

Load 1.47.0+

Load an image from URL and return base64 encoded string

OGX.Media.load('/img/image.png', (__base64) => {});

toFile 1.50.0+

Convert a base64 encoded media to a File object

const file = OGX.Media.toFile('data:image/png;base64,...', 'mypic.png');