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.
1.32.0+
Crop 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 andy
50px
OGX.Media.crop('ar23ez4a5r...', (__base64) => {...}, 100, 100, 50, 50);
1.45.0+
Read Convert a media
File
into a useableurl
OGX.Media.read(_FILE_, _CALLBACK_);
Practical example
OGX.Media.read(myFile, (__file, __url) => { ... });
1.47.0+
Load Load an image from URL and return base64 encoded string
OGX.Media.load('/img/image.png', (__base64) => {});
1.50.0+
toFile Convert a base64 encoded media to a File object
const file = OGX.Media.toFile('data:image/png;base64,...', 'mypic.png');