Images alt tag not coming from Article title

1 year 11 months ago #16035 by gdadmin
Hi 
Using the SEOFLI - SEO Friendly Links and Images to add alt text on the images.
On category blog pages in Joomla the intro image if missing the alt text its adding the image name instead of article title.
I did some customizations in the plugin code below to pick article title instead. If it could be an improvement in next update
if (preg_match('@title\s*=\s*[\"\'](.*)[\"\']@Uis', $imageNew, $titleText)) {

if (preg_match('@alt\s*=\s*[\"\'](.*)[\"\']@Uis', $imageNew, $altText)) {
if (empty($altText[1]) || $this->params->get('overwriteImages', 0)) {
$imageName = $titleText[1];
$imageNew = str_replace($altText[0], 'alt="' . $imageName . '"', $imageNew);
$images[1][$count] = str_replace($altText[0], 'alt="' . $imageName . '"', $images[1][$count]);
}


}else{
$imageWithAlt = $images[1][$count] . ' alt="' . $titleText[1] . '"';
$imageNew = str_replace($images[1][$count], $imageWithAlt, $imageNew);
$images[1][$count] = $imageWithAlt;
}
return;
}
The topic has been locked.
1 year 11 months ago #16038 by Viktor
Please log in to see the response. Attention: You need a valid subscription to activate an account.
The topic has been locked.
Time to create page: 0.122 seconds