Currently, there appears to be no means to add alt text to images in Word2007 Writer. Alt text is important because it is displayed in lieu of the image if the image fails to load for some reason. It is also an important accessibility feature, since it allows screen readers to describe the content of an image if the image is not visible to a user.
Describe the expected behavior
The addImage usage should change from:
$section->addImage($src, [$style]);
to:
$section->addImage($src, [$style], [string $altText]);
I have code that adds this capability, but it would help to know if the $name variable is used with images, so that I can avoid conflicts in the order of Image properties.
In file src/PhpWord/Element/Image.php, line 149 shows the following:
public function __construct($source, $style = null, $watermark = false, $name = null)
The $name variable is not addressed in any documentation that I found, but it does appear on line 73 of tests/PhpWordTests/Element/ImageTest.php. If it is not used, then I would like to change the above constructor as follows, since it will provide a simpler call to add an image that is not a watermark:
public function __construct($source, $style = null, $altText = null, $watermark = false, $name = null)
If $name is used, then I will put the new $altText property at the end:
public function __construct($source, $style = null, $watermark = false, $name = null, $altText = null)
Priority
[ ] I want to crowdfund the feature (with @algora-io) and fund a community developer.
[ ] I want to pay the feature and fund a maintainer for that. (Contact @Progi1984)
Describe the problem
Currently, there appears to be no means to add alt text to images in Word2007 Writer. Alt text is important because it is displayed in lieu of the image if the image fails to load for some reason. It is also an important accessibility feature, since it allows screen readers to describe the content of an image if the image is not visible to a user.
Describe the expected behavior
The addImage usage should change from: $section->addImage($src, [$style]); to: $section->addImage($src, [$style], [string $altText]);
I have code that adds this capability, but it would help to know if the $name variable is used with images, so that I can avoid conflicts in the order of Image properties. In file src/PhpWord/Element/Image.php, line 149 shows the following: public function __construct($source, $style = null, $watermark = false, $name = null)
The $name variable is not addressed in any documentation that I found, but it does appear on line 73 of tests/PhpWordTests/Element/ImageTest.php. If it is not used, then I would like to change the above constructor as follows, since it will provide a simpler call to add an image that is not a watermark: public function __construct($source, $style = null, $altText = null, $watermark = false, $name = null)
If $name is used, then I will put the new $altText property at the end: public function __construct($source, $style = null, $watermark = false, $name = null, $altText = null)
Priority