muban大师 发表于 2019-12-28 15:54:15

织梦dede怎么修改图片水印所在的位置

在织梦默认的水印位置上是和图片的边缘有5个像素的距离,可能也会有很多朋友想要修改水印所在的位置,放在一个自己想要的位置上。
       
                打开include/image.class.php
       
                找到以下代码:
       
                case 1:
       
                $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就是水印的位置,只要修改上面代码中的数据就可以修改水印位置了。以上9个位置依次对应的也就是“顶部居左、顶部居中、顶部居右、左边居中、图片中心、右边居中、底部居左、底部居中、底部居右”。
       
                例:
       
                case 9:
       
                $x = $imagewidth - $logowidth - 5;
       
                $y = $imageheight - $logoheight -5;
       
                如果想要和默认设置的水印位置重合,就要把“5”换成“0”。
页: [1]
查看完整版本: 织梦dede怎么修改图片水印所在的位置