News:

Support the VirtueMart project and become a member

Main Menu

displayMediaThumb without alt argument

Started by alxgan, August 06, 2024, 13:20:52 PM

Previous topic - Next topic

alxgan

Hello,

I wanted an image/thumb without alt argument because of the text readers.
The problem is that even if you set alt="" or not, it will display the file alternative text as alt argument.
echo $product->images[0]->displayMediaThumb (["class"=>"img-fluid w-100", "alt"=>""],FALSE,"", true, FALSE, FALSE, $widthThumb, $heightThumb);
For me, it will be more logic to have in function displayIt (mediahandler.php, line 810):
if(!isset($imageArgs['alt']) and !empty($file_alt)){
$imageArgs['alt'] = $file_alt;
}
instead of:
if(empty($imageArgs['alt']) and !empty($file_alt)){
$imageArgs['alt'] = $file_alt;
}


This modification will read as:
if alt argument is not defined and the file has an alternative text, then display the alt argument as the file alternative text. if alt argument exist (is defined) but empty (no value) then do not add it to img tag; if alt argument exists and has a value, display the value as alt argument.