muban大师 发表于 2021-3-5 10:52:38

Dedecms5.7任意调整水印在图片的位置教程

在使用DEDECMS过程中,本站发现,开启DEDECMS水印功能后,后台虽然有9个位置可以选择水印的位置,但是无论哪个位置都是系统设置好的固定位置,比如我想让水印图片贴边显示,如果只选择系统默认位置根本不可能靠边,这时候,我们发现,通过修改一个PHP文件,我们也可以任意调整水印图片的位置,主要就是通过下面几个参数来实现的。
       
        具体教程如下:
       
       
       
        打开根目录include下的image.class.php文件,用开查找
       
        x = +5;
       
        $y = +5;
       
        break;
       
        case 2:
       
        $x = ($imagewidth - $logowidth) / 2;
       
        $y = +5;
       
        break;
       
        case 3:
       
        $x = $imagewidth - $logowidth - 5;
       
        $y = +5;
       
        break;
       
        case 4:
       
        $x = +5;
       
        $y = ($imageheight - $logoheight) / 2;
       
        break;
       
        case 5:
       
        $x = ($imagewidth - $logowidth) / 2;
       
        $y = ($imageheight - $logoheight) / 2;
       
        break;
       
        case 6:
       
        $x = $imagewidth - $logowidth - 5;
       
        $y = ($imageheight - $logoheight) / 2;
       
        break;
       
        case 7:
       
        $x = +5;
       
        $y = $imageheight - $logoheight - 5;
       
        break;
       
        case 8:
       
        $x = ($imagewidth - $logowidth) / 2;
       
        $y = $imageheight - $logoheight - 5;
       
        break;
       
        case 9:
       
        $x = $imagewidth - $logowidth - 5;
       
        $y = $imageheight - $logoheight -5;
       
        break;
       
        栏目从1-9,也就是水印的位置,和下表是相对应的,这里你就可以修改后面的数据修改坐标了。
       
        顶部居左 顶部居中 顶部居右
       
        左边居中 图片中心 右边居中
       
        底部居左 底部居中 底部居右
       
        比如我把水印图与原图的右下角底部重合,就把第九项的两个“5”修改为“0”即可。
页: [1]
查看完整版本: Dedecms5.7任意调整水印在图片的位置教程