Skip to Content
🎉 New release with new features and improvements! V0.0.2 Release →

Image Service

The Image Service provides methods for uploading images to cloud storage with optional metadata and organization.

Methods

upload

Uploads an image file to cloud storage with optional namespace, asset ID, and metadata options.

const fileInput = document.querySelector('input[type="file"]'); const file = fileInput.files[0]; await bshEngine.image.upload({ payload: { file: file, namespace: 'products', assetId: 'product-123', options: { tags: ['product', 'main'], context: { alt: 'Product image', category: 'electronics' } } } });
PropertyTypeRequiredDescription
fileFileyesThe image file to upload
namespacestringnoOptional namespace for organizing images (folder name)
assetIdstringnoOptional asset ID for the image (file name)
optionsobjectnoOptional upload options object (customizable)
options.tagsstring[]noArray of tags for the image
options.contextobjectnoCustom context object with additional metadata (e.g., alt text, category)