Media library
Images and PDF documents are stored once, in the site's media library. An image slot stores only a reference to a library image plus its own alt text, and a file slot (<sb-file>) a reference to a document plus its link text, so any number of pages, fragments and versions can use the same file without copying it.
Choosing an image
Clicking an image slot in edit mode opens the media rail on the right. The editor picks an existing image, or uploads a new one, which is added to the library and selected. The page shows the new image straight away; it is kept when the editor chooses Save as draft or Save and publish, like any other change.
The page's share image, in Page settings, is chosen from the same rail. See SEO page settings.
Choosing a document
Clicking a file slot in edit mode opens the same rail, listing the library's documents instead of its images. The editor picks one or uploads a PDF, and Save as draft or Save and publish keeps it. Each picker lists only its own kind, and a save that puts a document in an image slot, or an image in a file slot, is refused.
Uploads
- Accepted types: JPEG, PNG, WebP and GIF images, and PDF documents. SVG is refused. The type is checked from the file's contents, not its extension, and the image picker accepts only images, the document picker only PDFs.
- The size limit is 10 MB by default, and configurable with
SunBird:Media:MaxUploadMegabytes. - SunBird does not resize images. Upload them at the size the site needs.
- Uploading a file that is already in the library reuses the existing image instead of storing a copy.
Alt text
Alt text belongs to the slot, not the image, because the same photo can mean different things on different pages. The editor changes it in the media rail. An empty alt text marks a decorative image. Until an image is chosen for a slot, the slot keeps its built-in image and alt text from the markup.
Deleting
An image or document can be deleted when no page's or fragment's current published version or draft uses it. If older versions use it, the editor is warned that those versions will lose the image, and must confirm.
A deleted image's file is removed, but its library record stays. Previewing an old version that used it shows the slot's markup default, outlined as deleted. Restoring that version publishes it without the image, so the slot shows its markup default (and a deleted share image is left out). A file slot whose document was deleted falls back to its markup href and text in the same way.
Storage
Files are kept through the site's HCI.FileStorage IFileStorageService, such as Azure Blob Storage, and served by SunBird at /sunbird/media/{id}, or for a document /sunbird/media/{id}/{file-name}. See Store images.