@@ -35,7 +35,7 @@ cd /path/to/my-project.test
3535composer require fork/craft-altify
3636
3737# tell Craft to install the plugin
38- ./craft plugin/install alt
38+ ./craft plugin/install altify
3939```
4040
4141## Usage
@@ -53,22 +53,18 @@ You can also set the model via ENV variable. This can be a class name, or one of
5353 <tr>
5454 <th>Model name</th>
5555 <th>Link</th>
56- <th>Config name</th>
5756 </tr>
5857 <tr>
5958 <td>BLIP (large)</td>
6059 <td><a>https://huggingface.co/Salesforce/blip-image-captioning-large</a></td>
61- <td>BLIP large model (Hugging Face)</td>
6260 </tr>
6361 <tr>
6462 <td>BLIP (base)</td>
6563 <td><a>https://huggingface.co/Salesforce/blip-image-captioning-base</a></td>
66- <td>BLIP base model (Hugging Face)</td>
6764 </tr>
6865 <tr>
6966 <td>...</td>
7067 <td>...</td>
71- <td>...</td>
7268 </tr>
7369</table >
7470
@@ -78,37 +74,59 @@ You can also set the model via ENV variable. This can be a class name, or one of
7874 <tr>
7975 <th>Model name</th>
8076 <th>Link</th>
81- <th>Config name</th>
8277 </tr>
8378 <tr>
84- <td>DeepL</td>
79+ <td>DeepL API </td>
8580 <td><a>https://developers.deepl.com/docs</a></td>
86- <td>DeepL</td>
8781 </tr>
8882 <tr>
8983 <td>OPUS MT (EN → DE)</td>
9084 <td><a>https://huggingface.co/Helsinki-NLP/opus-mt-en-de</a></td>
91- <td>OPUS MT En -> De</td>
9285 </tr>
9386 <tr>
9487 <td>Google T5 small (EN → DE)</td>
9588 <td><a>https://huggingface.co/google-t5/t5-small</a></td>
96- <td>T5 small En -> De</td>
9789 </tr>
9890 <tr>
9991 <td>...</td>
10092 <td>...</td>
101- <td>...</td>
10293 </tr>
10394</table >
10495
105- ### Implementing own alt text generator services
96+ ### Implementing own alt text generators and translators
10697
10798You can implement your own alt text generator service by implementing the interface
108- ` fork\alt\connectors\alttextgeneration\AltTextGeneratorInterface ` and configuring this plugin to use it
109- by setting your own generator's class name via ENV variable.
99+ ` fork\alt\connectors\alttextgeneration\AltTextGeneratorInterface ` and registering it via the ` EVENT_REGISTER_GENERATORS `
100+ event like this:
101+
102+ ```
103+ use fork\altify\events\RegisterGeneratorsEvent;
104+ use fork\altify\services\Generator;
105+
106+ Event::on(
107+ Generator::class,
108+ Generator::EVENT_REGISTER_GENERATORS,
109+ function (RegisterGeneratorsEvent $event) {
110+ $event->generators['myGenerator'] = MyGenerator::class;
111+ }
112+ );
113+ ```
114+
115+ The same goes for translator services. Implement ` fork\altify\connectors\translation\TranslatorInterface ` and register
116+ your translator like this:
110117
111- In a future release it should be possible to register alt text generators with an event.
118+ ```
119+ use fork\altify\events\RegisterTranslatorsEvent;
120+ use fork\altify\services\Translator;
121+
122+ Event::on(
123+ Translator::class,
124+ Translator::EVENT_REGISTER_TRANSLATORS,
125+ function (RegisterTranslatorsEvent $event) {
126+ $event->translators['myTranslator'] = MyTranslator::class;
127+ }
128+ );
129+ ```
112130
113131---
114132
@@ -117,7 +135,7 @@ In a future release it should be possible to register alt text generators with a
117135* Make translation services site based to respect languages
118136* Implement more alt text generation services
119137* Maybe implement a self-hosted alt text generation service
120- * Maybe implement an alt text generation service running in browser with TensorFlow JS
138+ * Maybe implement an alt text generation service running in browser with TensorFlow JS or something similar
121139* Implement an alt text generator registering event
122140* Make public on GitHub, release on Packagist and the Craft Plugin Store
123141
0 commit comments