In fact, there are many methods on the Internet to add alt attributes to images in dedecms content, but some of them are not perfect or perfect, and some of the disadvantages are that the content in the body is not really modified every time, that is, the content saved in the database is not changed, but is modified before generating html, so the effect of adding alt titles is only expressed on the html page. However, there are ways to really modify the content (database content). Here I will summarize the perfect solution to this problem. The article originates from the fallen fish- https://www.duoluodeyu.com/483.html
Disadvantages of this method: when the content contains image code like img, it may be regarded as the image to be modified. If related files are involved in the upgrade, they need to be modified after the upgrade. The article originates from the fallen fish- https://www.duoluodeyu.com/483.html
Applicable version: DEDECMS V5.3 or above (not tried before, but it should be OK) The article originates from the fallen fish- https://www.duoluodeyu.com/483.html
Modify the file: dede/inc/inc_archives_functions.php The article originates from the fallen fish- https://www.duoluodeyu.com/483.html
Find the "//Small image of the large image in the atlas", and add the following code to it (the location does not need to be fixed, and other places can also be used): The article originates from the fallen fish- https://www.duoluodeyu.com/483.html
//Replace Picture Alt as Document Title
$body = str_ireplace(array('alt=""','alt=\'\''),'',$body);
$body = preg_replace("@ [\s] {0,}alt [\s]{0,}=[\"'\s]{0,}[\s\S]{0,}[\"'\s] @isU"," ",$body);
$body = str_ireplace("<img " ,"<img alt='".$title."' ",$body); The article originates from the fallen fish- https://www.duoluodeyu.com/483.html
If you encounter any problems in the practical process, please leave a message for me and I will answer them as soon as possible. The article originates from the fallen fish- https://www.duoluodeyu.com/483.html