ADUPREce 发表于 2019-5-24 00:00:00

DEDE:修改fck编辑器上传图片后自动居中显示

DEDECMS版fck编辑器上传图片后插入编辑器后默认为左对齐,在图片下一行加上ALT描述作为说明文字默认也是左对齐,对于我们经常上传图片的来说,每次都要手动设置为居中显然会浪费我们太多的时间,下面我们就把这两个地方修改为居中显示。

打开\include\FCKeditor\editor\dialog文件夹中的dede_image.php,找到149行到168行,即:

if($cfg_remote_site=='Y' && $remoteuploads == 1)
{
          $imgsrcValue = $remoteupUrl.$imgsrcValue;
          $urlValue = $remoteupUrl.$urlValue;
          $imgHtml .="<img src=\"$imgsrcValue\" width=\"$imgwidthValue\" border=\"0\" height=\"$imgheightValue\" alt=\"$altname\" style=\"cursor:pointer\" onclick=\"window.open('$urlValue')\" /><br />\r\n";
} else {
      if($cfg_multi_site=='N')
      {
                $imgHtml .="<img src=\"$imgsrcValue\" width=\"$imgwidthValue\" border=\"0\" height=\"$imgheightValue\" alt=\"$altname\" style=\"cursor:pointer\" onclick=\"window.open('$urlValue')\" /><br />\r\n";
      }
      else
      {
                if(empty($cfg_basehost)) $cfg_basehost = 'http://'.$_SERVER["HTTP_HOST"];
                $imgHtml .="<img src=\"$imgsrcValue\" width=\"$imgwidthValue\" border=\"0\" height=\"$imgheightValue\" alt=\"$altname\" style=\"cursor:pointer\" onclick=\"window.open('$urlValue')\" /><br />\r\n";
      }
}

if($alttitle==1 && !empty($altname)) {
      $imgHtml .= "$altname\r\n";
}

修改为:
if($cfg_remote_site=='Y' && $remoteuploads == 1)
{
          $imgsrcValue = $remoteupUrl.$imgsrcValue;
          $urlValue = $remoteupUrl.$urlValue;
          $imgHtml .="<p align=\"center\"><img src=\"$imgsrcValue\" width=\"$imgwidthValue\" border=\"0\" height=\"$imgheightValue\" alt=\"$altname\" /></p>";
} else {
      if($cfg_multi_site=='N')
      {
                $imgHtml .="<p align=\"center\"><img src=\"$imgsrcValue\" width=\"$imgwidthValue\" border=\"0\" height=\"$imgheightValue\" alt=\"$altname\" /></p>";
      }
      else
      {
                if(empty($cfg_basehost)) $cfg_basehost = 'http://'.$_SERVER["HTTP_HOST"];
                $imgHtml .="<p align=\"center\"><img src=\"$imgsrcValue\" width=\"$imgwidthValue\" border=\"0\" height=\"$imgheightValue\" alt=\"$altname\" /></p>";
      }
}

if($alttitle==1 && !empty($altname)) {
      $imgHtml .= "<p align=\"center\">$altname</p>\r\n";
}

tcbxh2008 发表于 2019-5-24 00:00:01

太棒了,感谢楼主,10万社区是我家维护靠大家.

nshukwrd 发表于 2019-5-24 00:05:00

我是路过10万社区社区,拿分走人呵呵,楼下继续!

wyo315 发表于 2019-5-24 01:06:06

好东西一定要看看!

twxd 发表于 2019-5-24 01:49:31

膜拜神贴,后面的请保持队形~

bushuang 发表于 2019-5-24 01:57:43

沙发~支持楼主,支持10万社区社区,希望10万社区社区越办越好.

wyo315 发表于 2019-5-24 02:30:19

哥顶的不是帖子,是寂寞!

tgboler 发表于 2019-5-24 02:56:48

谢谢您的分享!

pAxvOHtH 发表于 2019-5-24 02:58:51

楼主,不论什么情况你一定要hold住!hold住就是胜利!

joy3118 发表于 2019-5-24 03:03:36

看帖看完了至少要顶一下,还可以加入到淘帖哦!
页: [1]
查看完整版本: DEDE:修改fck编辑器上传图片后自动居中显示