織夢kindeditor編輯器圖片上傳增加圖片alt屬性和title屬性的方法

佚名發表於2020-06-16

 文章主要介紹了織夢kindeditor編輯器圖片上傳增加圖片alt屬性和title屬性的方法,下面是透過網路收集整理的方法教程,給大家做個參考。

織夢kindeditor編輯器圖片上傳增加圖片說明alt屬性和title屬性效果圖:

織夢kindeditor編輯器圖片上傳增加圖片alt屬性和title屬性的方法

1、在織夢/include/kindeditor/kindeditor-all.js 或者 /kindeditor/kindeditor.js 或者 /kindeditor/kindeditor-min.js 找到圖片按鈕的程式碼:

'<div class="tab2" style="display:none;">',

在裡面加入

'<div class="ke-dialog-row">',
'<label for="remoteTitle" style="width:60px;">' + lang.imgTitle + '</label>',
'<input type="text" id="remoteTitle" class="ke-input-text" name="title" style="width:200px;" />',
'<input id="autotitle" class="np" type="checkbox" onclick="if($(this).is(\':checked\')){$(this).prev().val($(\'#title\').val());}else{$(this).prev().val(\'\');}"> 使用文章標題',
'</div>',

織夢kindeditor編輯器圖片上傳增加圖片alt屬性和title屬性的方法

2、kindeditor_post.php 或者 kindeditor\php\upload_json.php 找到:

echo $json->encode(array('error' => 0, 'url' =>

改成

$img_title = $_POST['title'];
echo $json->encode(array('error' => 0, 'url' => $activepath."/$mdir/".$filename_name, 'title'=>$img_title));

就是加了 img_title 而已,注意你的程式碼,不一定跟我上面的是一樣的。在你的基礎上加入而已。

以上是整理的織夢kindeditor編輯器圖片上傳增加圖片alt屬性和title屬性的方法全部程式碼內容,希望文章能夠幫你解決所遇到的程式開發問題。

 

 

 

 

 

相關文章