How to add alt-text to images on Friendica, Hubzilla, (streams) and Forte/en

Unlike microblogging-centric , 
, , and don't have dedicated entry fields for in their post entry masks.
It's still possible to add alt-text to images on all four. But since they're deeply rooted in long-form blogging, this requires manually touching markup code on Friendica and Hubzilla, and it may require touching markup code on (streams) and Forte.
What all four have in common is that they embed images within the post text just like a blogging engine. Some projects like don't support this, so all four make copies of embedded images as file attachments for Fediverse projects that don't support inline images. The images keep their alt-texts in the process.
In any case, it is strongly recommended to write the alt-text before uploading and embedding an image.
== Limitation in length ==
All four don't have defined character limits for their posts. Since they embed alt-text into the post text code, the length of alt-text is unlimited, too, technically speaking.
However, Mastodon, and their respective forks have hard limits of 1,500 characters for alt-texts which, unlike their character limits for posts, are enforced on alt-texts from outside as well. Alt-texts that exceed 1,500 characters are truncated at the 1,500-character mark, and everything that goes beyond is discarded. This won't affect your original post, only the way it's displayed on instances of these projects.
But even if you're on Hubzilla or (streams), and you've got ActivityPub off so that neither of these projects can connect to your channel, your alt-texts shouldn't be significantly longer than this. This is because the Web interfaces of Hubzilla and (streams) can only show so much alt-text at once in the pop-up window, depending on device, browser, screen resolution, font size etc. And the alt-text in the pop-up window cannot be scrolled; trying to do so will close the pop-up window.
Generally speaking, alt-text shouldn't grow too long. That's simply because a screen reader can read alt-text, but it can't navigate alt-text. It isn't possible to jump back to a certain point within an alt-text and have part of it re-read. It is only possible to jump back to the beginning of the alt-text and have all of it re-read. The longer an alt-text is, the more tedious this becomes.
== How-tos ==
=== Adding alt-text on Friendica ===
The standard way of adding images to a new post on Friendica is by using the post editor to upload the image to the file space built into your account. Friendica will automatically generate image-embedding code at the end of the post draft.
Alternatively, the image can be uploaded to the file space manually which give you control over where exactly it is stored. In this case, however, the image-embedding code will have to be written manually.
This is what the image-embedding code normally looks like and how it's automatically generated when uploading an image using the post editor:
[img]https://<Image file URL>[/img]
Alt-text must be put between the [img][/img] tags. However, this is where the image file URL is.
So the first step is to cut the image file URL from its usual place between [img] and [/img] and paste it into the [img] tag. If there is already a size specified in the [img] tag at which the image is to be shown, e.g. [img=480x320], the size must be overwritten.
After the first step, the image-embedding code must look like this:
[img=https://<Image file URL>][/img]
The second and final step is to put the alt-text between the [img] tag and the [/img] tags.
[img=https://<Image file URL>]<Alt-text>[/img]
=== Adding alt-text on Hubzilla ===
On Hubzilla, the handling of alt-text in code is similar to Friendica, but the handling of images before that is different.
Images can be attached to Hubzilla posts, just like on Mastodon. But then they won't be embedded into the post, just like on Mastodon. And unlike on Mastodon, you won't have any means to add alt-text to them. The alt-text will be the file name.
If you want to add alt-text to images on Hubzilla, you'll first have to upload them to the file space built into your channel using the Photos app so that Hubzilla recognises them as image files and handles them accordingly. Like on Friendica, this comes with the advantage of being able to choose an album which to add the image to. Afterwards, you can embed the image into the post draft.
This gives you image-embedding code like this:
[zrl=https://<Image page URL>][zmg=<Max. image size>]https://<Image file URL>[/zmg][/zrl]
From here on, there aren't many differences to how alt-text is handled on Friendica, only that Hubzilla adds a link to a page within the channel where the image can be viewed, and Hubzilla uses special tags that support its access and permission control system.
Now there are two ways of handling alt-text in Hubzilla. One is to move the image file URL into the [zmg] tag, replace the maximum image size with it and put the alt-text between the [zmg] tag and the [/zmg] tag where the image file URL used to be.
An easier and more flexible way is to make the alt-text an extra parameter in the [zmg] tag that starts with title=. The maximum image size can be defined in various ways or omitted.
[zrl=https://<Image page URL>][zmg=https://<Image file URL>]<Alt-text>[/zmg][/zrl]
[zrl=https://<Image page URL>][zmg=<Max. image size> title="<Alt-text>]https://<Image file URL>[/zmg][/zrl]
[zrl=https://<Image page URL>][zmg="<Max. image size>" title="<Alt-text>]https://<Image file URL>[/zmg][/zrl]
[zrl=https://<Image page URL>][zmg width="<Max. image width>" title="<Alt-text>]https://<Image file URL>[/zmg][/zrl]
[zrl=https://<Image page URL>][zmg height="<Max. image height>" title="<Alt-text>]https://<Image file URL>[/zmg][/zrl]
If no image size, width or height is specified, the maximum image size is defined by the additional digit at the end of the image file URL. No digit and -0 allow for the original image size to be shown if there is enough space. -1 limits the width to 1024 pixels, -2 limits it to 640 pixels, -2 limits it to 320 pixels. And if both width and height are specified as parameters, Hubzilla changes the aspect ratio and distorts the image.
=== Adding alt-text on (streams) and Forte ===
Similarly to Hubzilla, adding alt-text to an image on (streams) or Forte starts with uploading it using the Photos app. Again, this allows you to choose into which album you want to upload an image.
The big difference to Hubzilla is that what is put into the description field will be used as alt-text when embedding the image. So unlike Friendica and Hubzilla, (streams) and Forte do have an alt-text entry field, just not as part of the post editor.
So before uploading the image, the first step is to add the alt-text for the image to the description field. Then you can upload the image.
The next step is to go to your channel page or your stream page and use the file attachment button to embed the image into your post draft.
Regardless of whether or not your channel supports decentralised IDs, the image-embedding code will look like this:
[zrl=https://<Image page URL>][zmg alt="<Alt-text>"]https://<Image file URL>[/zmg][/zrl]
The most important difference is that (streams) and Forte have an alt= parameter for alt-text whereas Hubzilla has a title= parameter.
If you have accidentally uploaded an image without adding an alt-ext first, it is embedded with its original file name as its alt-text.
[zrl=https://<Image page URL>][zmg alt="<Original image file name>"]https://<Image file URL>[/zmg][/zrl]
You can safely edit the file name out and replace it with an actual alt-text as shown above.
Other than the alt= parameter instead of the title= parameter, image size handling is slightly different: (streams) and Forte completely ignore the defined image height, also to keep the aspect ratio intact. It can be specified, but it won't have any effect.
[zrl=https://<Image page URL>][zmg=<Defined image size> alt="<Alt-text>"]https://<Image file URL>[/zmg][/zrl]
[zrl=https://<Image page URL>][zmg="<Defined image size>" alt="<Alt-text>"]https://<Image file URL>[/zmg][/zrl]
[zrl=https://<Image page URL>][zmg width="<Defined image width>" alt="<Alt-text>"]https://<Image file URL>[/zmg][/zrl]
==== Markdown and HTML ====
(streams) and Forte also support Markdown and HTML in their posts and comments next to BBcode. But while it's theoretically possible to embed images using Markdown or HTML, neither supports the permissions and identity system like the special BBcode tags [zrl][zmg][/zmg][/zrl]; thus, embedding images using Markdown or HTML is not recommended.