-
- function user_imgalt($mid,$f,$isadd,$isq,$value,$cs){
- $title=$_POST['title'];
- $htmls=$value;
- $pattern = "/<img[^>]+>/";
- preg_match_all($pattern, $htmls, $matches);
- for ($i=0; $i<=count($matches[0]); $i++) {
- preg_match_all("/alt=".+?"/",$matches[0][$i],$altimg);
- $t_alt=count($altimg[0]);
- if($t_alt==0){
- $htmls=str_replace("<img","<img alt="{$title}"",$htmls);
- }else{
- $htmls=str_replace($altimg[0][0],"alt="{$title}"",$htmls);
- }
- }
- return $htmls;
- }
|