Extensions add specific functionality to Learnosity APIs. They rely on modules within LT being available.
--
This extension replaces the default Learnosity image uploader with a custom image uploader that supports image editing and compression before uploading to the Learnosity CDN.
Consider this extension if you're looking to reduce the file size of images or if you want to give users the flexibility to crop or rotate them before uploading.
Supported mime types: image/gif
, image/jpeg
, image/png
, image/svg+xml
.webp files are not supported by Learnosity, so we don't support them here.
Animated gifs become static.
By default, we resize images to a maximum width or height of 1500px. The calling
page can override width
, height
, and quality
. See below in run()
.
Image comparisons (before and after)
Click image to view full size.
Exclusions
This extension doesn't run inside the simple features dialog. This mainly impacts posters for video files and background images for audio files.
Methods
run(security, request, optionsopt)
Extension constructor. We require security
and request
from the Author API
initialisation to be passed in.
Since
- 2.10.0
Example
import { LT } from '@caspingus/lt/src/authoring/core';
import * as imageUploader from '@caspingus/lt/src/authoring/extensions/ui/imageUploader/index';
LT.init(authorApp); // Set up LT with the Author API application instance variable
// Put individual extensions in the LT object if that makes your life easier
LT.extensions = {
imageUploader,
};
LT.extensions.imageUploader.run(security, request);
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
security |
object | The security object returned from the SDK. |
|
request |
object | The request object returned from the SDK. |
|
options |
object |
<optional> |
Override for |