Download the PHP package tomvondracek/bolt-ai-image-alt without Composer

On this page you can find all versions of the php package tomvondracek/bolt-ai-image-alt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package bolt-ai-image-alt

AI Image Alt Texts for Bolt CMS

https://github.com/user-attachments/assets/bad597c5-481c-49e3-b9bd-765218955408

Generates image ALT texts in the Bolt 6 admin, in the editor's browser:

Image data never leaves the browser, and there are no API costs. Only the model weights are downloaded once from Hugging Face (a few hundred MB) and cached by the browser.

Features

Installation

extensions:configure copies the prebuilt browser files to public/extensions/ai-alt/. Node.js is not needed on the server. Run it again after every update of the extension.

Configuration

config/extensions/tomvondracek-aialt.yaml (created on first use; see config/config.yaml for all options):

Saving from the batch page also requires the edit permission on each record.

Browser support

Browser Captioning Translation
Chrome / Edge desktop (138+) WebGPU Translator API (the language pack downloads after the first click)
Firefox, Safari WebGPU or WASM none → fallback_without_translator
Mobile slow or unavailable none

Without WebGPU the model runs on WebAssembly single-threaded: the Bolt admin isn't cross-origin isolated (no COOP/COEP headers), so ONNX Runtime can't use worker threads. Expect several seconds per image there. GPUs without shader-f16 get fp32 weights; if WebGPU fails anyway, the worker falls back to WebAssembly. A caption that takes longer than 3 minutes is aborted and the model reloaded, so a hung GPU can't block the queue.

When no translator is available, the alt stays empty by default and the chip says so. With fallback_without_translator: english the English caption is written and marked "EN – please translate". English sites need no translator.

Content Security Policy

Bolt sets no CSP. If your hosting adds one, the admin needs:

(connect-src for Hugging Face is not needed with self-hosted weights, see model_host.)

Self-hosted model weights

Download the model repository (config.json, preprocessor_config.json, tokenizer*.json, generation_config.json, onnx/*.onnx) into e.g. public/ai-alt-models/onnx-community/Florence-2-base-ft/ and set model_host: /ai-alt-models. Don't use public/extensions/ai-alt/, because extensions:configure replaces it.

model_host is read like this: a bare origin (https://huggingface.co, or a mirror like https://hf-mirror.com) uses the Hub layout {model}/resolve/main/…; a URL with a path (/ai-alt-models, https://cdn.example.com/models) is a plain copy, {model}/…. If Bolt runs in a subdirectory, include it (/cms/ai-alt-models). The extension's own assets and thumbnails follow the subdirectory automatically.

Limitations

Development

To try it in a Bolt project from a local checkout:

Layout

Path What
src/Widget/AiAltWidget.php Injects #ai-alt-config + ai-alt.js before </body> on edit pages
src/Controller/BatchController.php Batch page, missing (JSON), save (JSON, CSRF + edit permission, 409 when already filled)
src/Service/* Field metadata, locale rules, finder and writer for missing alts
assets/fields.ts The only place that knows Bolt's Image.vue markup
assets/editor.ts Buttons, observers, sequential queue, write-back, save notice
assets/worker.ts Florence-2 in a module Web Worker
assets/translate.ts Translator API wrapper
assets/generate.ts AltProvider interface (the seam for server-side providers)

License

MIT


All versions of bolt-ai-image-alt with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
twig/twig Version ^3.30
symfony/polyfill-php84 Version ^1.38.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tomvondracek/bolt-ai-image-alt contains the following files

Loading the files please wait ...