Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

建议每个版块可以启用独立水印

[复制链接]
hsoon 发表于 2013-4-2 17:28:51 | 显示全部楼层 |阅读模式
本帖最后由 hsoon 于 2013-4-2 17:28 编辑

1、建议每个版块可以启用独立水印,方面绑定二级域名作为子站来运营;
2、建议数据调用的时候多一些筛选功能,比如图片小于多少尺寸的不调用,文字少于多少的不调用,(很多时候模版制作的是图片+标题+摘要,很多网友发一张图片,然后就调取不到文字,只有去手动屏蔽);
3、还有一点小问题就是如果我某个板块启用了二级域名(bbs2.xxx.com),但是,比如从首页(bbs.xxx.com) 幻灯片点击进去的话,主题地址还是bbs.xxx.com/******  并不是 bbs2.xxx.com/****** ;
yutai114 发表于 2013-4-2 18:13:55 | 显示全部楼层
想法不错
回复

使用道具 举报

杨小样 发表于 2013-4-4 23:26:06 来自手机 | 显示全部楼层
支持独立水印
回复

使用道具 举报

enhand 发表于 2013-4-6 13:11:25 | 显示全部楼层
我做了一个简单的,看看能否满足你的要求?
dz现在的应用中心很不好用,我的网站都好几年了,应用中心还是有问题。

  1. <P><?php</P>
  2. <P>/**
  3. *      [Discuz!] (C)2001-2099 Comsenz Inc.
  4. *      This is NOT a freeware, use is subject to license terms
  5. *
  6. *      $$$$Id: class_image.php 28223 2012-02-24 08:07:09Z zhengqingpeng $$$$
  7. */</P>
  8. <P>if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }</P>
  11. <P>
  12. class image {</P>
  13. <P> var $$$$source = '';
  14. var $$$$target = '';
  15. var $$$$imginfo = array();
  16. var $$$$imagecreatefromfunc = '';
  17. var $$$$imagefunc = '';
  18. var $$$$tmpfile = '';
  19. var $$$$libmethod = 0;
  20. var $$$$param = array();
  21. var $$$$errorcode = 0;</P>
  22. <P> function image() {
  23.   global $$$$_G;
  24.   $$$$s = &$$$$_G['setting'];
  25.   $$$$this->param = array(
  26.    'imagelib'  => $$$$s['imagelib'],
  27.    'imageimpath'  => $$$$s['imageimpath'],
  28.    'thumbquality'  => $$$$s['thumbquality'],
  29.    'watermarkstatus' => unserialize($$$$s['watermarkstatus']),
  30.    'watermarkminwidth' => unserialize($$$$s['watermarkminwidth']),
  31.    'watermarkminheight' => unserialize($$$$s['watermarkminheight']),
  32.    'watermarktype'  => $$$$s['watermarktype'],
  33.    'watermarktext'  => $$$$s['watermarktext'],
  34.    'watermarktrans' => unserialize($$$$s['watermarktrans']),
  35.    'watermarkquality' => unserialize($$$$s['watermarkquality']),
  36.   );
  37. }</P>
  38. <P>
  39. function Thumb($$$$source, $$$$target, $$$$thumbwidth, $$$$thumbheight, $$$$thumbtype = 1, $$$$nosuffix = 0) {
  40.   global $$$$_G;
  41.   $$$$return = $$$$this->init('thumb', $$$$source, $$$$target, $$$$nosuffix);
  42.   if($$$$return <= 0) {
  43.    return $$$$this->returncode($$$$return);
  44.   }</P>
  45. <P>  if($$$$this->imginfo['animated']) {
  46.    return $$$$this->returncode(0);
  47.   }
  48.   $$$$this->param['thumbwidth'] = $$$$thumbwidth;
  49.   $$$$this->param['thumbheight'] = $$$$thumbheight;
  50.   $$$$this->param['thumbtype'] = $$$$thumbtype;
  51.   if($$$$thumbwidth < 100 && $$$$thumbheight < 100) {
  52.    $$$$this->param['thumbquality'] = 100;
  53.   }</P>
  54. <P>  $$$$return = !$$$$this->libmethod ? $$$$this->Thumb_GD() : $$$$this->Thumb_IM();
  55.   $$$$return = !$$$$nosuffix ? $$$$return : 0;</P>
  56. <P>  return $$$$this->sleep($$$$return);
  57. }</P>
  58. <P> function Watermark($$$$source, $$$$target = '', $$$$type = 'forum') {
  59.   global $$$$_G;
  60.   $$$$return = $$$$this->init('watermask', $$$$source, $$$$target);
  61.   if($$$$return <= 0) {
  62.    return $$$$this->returncode($$$$return);
  63.   }
  64.                 $$$$markfid= $$$$_G['fid']? $$$$_G['fid'].'.png': 'watermark.png';
  65.   $$$$markfid=file_exists('./static/image/common/'.$$$$markfid)?$$$$markfid:'watermark.png';
  66.                 //echo $$$$markfid;
  67.   if(!$$$$this->param['watermarkstatus'][$$$$type] || ($$$$this->param['watermarkminwidth'][$$$$type] && $$$$this->imginfo['width'] <= $$$$this->param['watermarkminwidth'][$$$$type] && $$$$this->param['watermarkminheight'][$$$$type] && $$$$this->imginfo['height'] <= $$$$this->param['watermarkminheight'][$$$$type])) {
  68.    return $$$$this->returncode(0);
  69.   }
  70.   $$$$this->param['watermarkfile'][$$$$type] = './static/image/common/'.($$$$this->param['watermarktype'][$$$$type] == 'png' ? $$$$markfid : 'watermark.gif');
  71.   if(!is_readable($$$$this->param['watermarkfile'][$$$$type]) || ($$$$this->param['watermarktype'][$$$$type] == 'text' && (!file_exists($$$$this->param['watermarktext']['fontpath'][$$$$type]) || !is_file($$$$this->param['watermarktext']['fontpath'][$$$$type])))) {
  72.    return $$$$this->returncode(-3);
  73.   }</P>
  74. <P>  $$$$return = !$$$$this->libmethod ? $$$$this->Watermark_GD($$$$type) : $$$$this->Watermark_IM($$$$type);</P>
  75. <P>  return $$$$this->sleep($$$$return);
  76. }</P>
  77. <P> function error() {
  78.   return $$$$this->errorcode;
  79. }</P>
  80. <P> function init($$$$method, $$$$source, $$$$target, $$$$nosuffix = 0) {
  81.   global $$$$_G;</P>
  82. <P>  $$$$this->errorcode = 0;
  83.   if(empty($$$$source)) {
  84.    return -2;
  85.   }
  86.   $$$$parse = parse_url($$$$source);
  87.   if(isset($$$$parse['host'])) {
  88.    if(empty($$$$target)) {
  89.     return -2;
  90.    }
  91.    $$$$data = dfsockopen($$$$source);
  92.    $$$$this->tmpfile = $$$$source = tempnam($$$$_G['setting']['attachdir'].'./temp/', 'tmpimg_');
  93.    file_put_contents($$$$source, $$$$data);
  94.    if(!$$$$data || $$$$source === FALSE) {
  95.     return -2;
  96.    }
  97.   }
  98.   if($$$$method == 'thumb') {
  99.    $$$$target = empty($$$$target) ? (!$$$$nosuffix ? getimgthumbname($$$$source) : $$$$source) : $$$$_G['setting']['attachdir'].'./'.$$$$target;
  100.   } elseif($$$$method == 'watermask') {
  101.    $$$$target = empty($$$$target) ?  $$$$source : $$$$_G['setting']['attachdir'].'./'.$$$$target;
  102.   }
  103.   $$$$targetpath = dirname($$$$target);
  104.   dmkdir($$$$targetpath);</P>
  105. <P>  clearstatcache();
  106.   if(!is_readable($$$$source) || !is_writable($$$$targetpath)) {
  107.    return -2;
  108.   }</P>
  109. <P>  $$$$imginfo = @getimagesize($$$$source);
  110.   if($$$$imginfo === FALSE) {
  111.    return -1;
  112.   }</P>
  113. <P>  $$$$this->source = $$$$source;
  114.   $$$$this->target = $$$$target;
  115.   $$$$this->imginfo['width'] = $$$$imginfo[0];
  116.   $$$$this->imginfo['height'] = $$$$imginfo[1];
  117.   $$$$this->imginfo['mime'] = $$$$imginfo['mime'];
  118.   $$$$this->imginfo['size'] = @filesize($$$$source);
  119.   $$$$this->libmethod = $$$$this->param['imagelib'] && $$$$this->param['imageimpath'];</P>
  120. <P>  if(!$$$$this->libmethod) {
  121.    switch($$$$this->imginfo['mime']) {
  122.     case 'image/jpeg':
  123.      $$$$this->imagecreatefromfunc = function_exists('imagecreatefromjpeg') ? 'imagecreatefromjpeg' : '';
  124.      $$$$this->imagefunc = function_exists('imagejpeg') ? 'imagejpeg' : '';
  125.      break;
  126.     case 'image/gif':
  127.      $$$$this->imagecreatefromfunc = function_exists('imagecreatefromgif') ? 'imagecreatefromgif' : '';
  128.      $$$$this->imagefunc = function_exists('imagegif') ? 'imagegif' : '';
  129.      break;
  130.     case 'image/png':
  131.      $$$$this->imagecreatefromfunc = function_exists('imagecreatefrompng') ? 'imagecreatefrompng' : '';
  132.      $$$$this->imagefunc = function_exists('imagepng') ? 'imagepng' : '';
  133.      break;
  134.    }
  135.   } else {
  136.    $$$$this->imagecreatefromfunc = $$$$this->imagefunc = TRUE;
  137.   }</P>
  138. <P>  if(!$$$$this->libmethod && $$$$this->imginfo['mime'] == 'image/gif') {
  139.    if(!$$$$this->imagecreatefromfunc) {
  140.     return -4;
  141.    }
  142.    if(!($$$$fp = @fopen($$$$source, 'rb'))) {
  143.     return -2;
  144.    }
  145.    $$$$content = fread($$$$fp, $$$$this->imginfo['size']);
  146.    fclose($$$$fp);
  147.    $$$$this->imginfo['animated'] = strpos($$$$content, 'NETSCAPE2.0') === FALSE ? 0 : 1;
  148.   }</P>
  149. <P>  return $$$$this->imagecreatefromfunc ? 1 : 0;
  150. }</P>
  151. <P> function sleep($$$$return) {
  152.   if($$$$this->tmpfile) {
  153.    @unlink($$$$this->tmpfile);
  154.   }
  155.   $$$$this->imginfo['size'] = @filesize($$$$this->target);
  156.   return $$$$this->returncode($$$$return);
  157. }</P>
  158. <P> function returncode($$$$return) {
  159.   if($$$$return > 0 && file_exists($$$$this->target)) {
  160.    return true;
  161.   } else {
  162.    $$$$this->errorcode = $$$$return;
  163.    return false;
  164.   }
  165. }</P>
  166. <P> function exec($$$$execstr) {
  167.   exec($$$$execstr, $$$$output, $$$$return);
  168.   if(!empty($$$$return) || !empty($$$$output)) {
  169.    return -3;
  170.   }
  171.   return true;
  172. }</P>
  173. <P> function sizevalue($$$$method) {
  174.   $$$$x = $$$$y = $$$$w = $$$$h = 0;
  175.   if($$$$method > 0) {
  176.    $$$$imgratio = $$$$this->imginfo['width'] / $$$$this->imginfo['height'];
  177.    $$$$thumbratio = $$$$this->param['thumbwidth'] / $$$$this->param['thumbheight'];
  178.    if($$$$imgratio >= 1 && $$$$imgratio >= $$$$thumbratio || $$$$imgratio < 1 && $$$$imgratio > $$$$thumbratio) {
  179.     $$$$h = $$$$this->imginfo['height'];
  180.     $$$$w = $$$$h * $$$$thumbratio;
  181.     $$$$x = ($$$$this->imginfo['width'] - $$$$thumbratio * $$$$this->imginfo['height']) / 2;
  182.    } elseif($$$$imgratio >= 1 && $$$$imgratio <= $$$$thumbratio || $$$$imgratio < 1 && $$$$imgratio < $$$$thumbratio) {
  183.     $$$$w = $$$$this->imginfo['width'];
  184.     $$$$h = $$$$w / $$$$thumbratio;
  185.    }
  186.   } else {
  187.    $$$$x_ratio = $$$$this->param['thumbwidth'] / $$$$this->imginfo['width'];
  188.    $$$$y_ratio = $$$$this->param['thumbheight'] / $$$$this->imginfo['height'];
  189.    if(($$$$x_ratio * $$$$this->imginfo['height']) < $$$$this->param['thumbheight']) {
  190.     $$$$h = ceil($$$$x_ratio * $$$$this->imginfo['height']);
  191.     $$$$w = $$$$this->param['thumbwidth'];
  192.    } else {
  193.     $$$$w = ceil($$$$y_ratio * $$$$this->imginfo['width']);
  194.     $$$$h = $$$$this->param['thumbheight'];
  195.    }
  196.   }
  197.   return array($$$$x, $$$$y, $$$$w, $$$$h);
  198. }</P>
  199. <P> function loadsource() {
  200.   $$$$imagecreatefromfunc = &$$$$this->imagecreatefromfunc;
  201.   $$$$im = @$$$$imagecreatefromfunc($$$$this->source);
  202.   if(!$$$$im) {
  203.    if(!function_exists('imagecreatefromstring')) {
  204.     return -4;
  205.    }
  206.    $$$$fp = @fopen($$$$this->source, 'rb');
  207.    $$$$contents = @fread($$$$fp, filesize($$$$this->source));
  208.    fclose($$$$fp);
  209.    $$$$im = @imagecreatefromstring($$$$contents);
  210.    if($$$$im == FALSE) {
  211.     return -1;
  212.    }
  213.   }
  214.   return $$$$im;
  215. }</P>
  216. <P> function Thumb_GD() {
  217.   global $$$$_G;</P>
  218. <P>  if(!function_exists('imagecreatetruecolor') || !function_exists('imagecopyresampled') || !function_exists('imagejpeg') || !function_exists('imagecopymerge')) {
  219.    return -4;
  220.   }</P>
  221. <P>  $$$$imagefunc = &$$$$this->imagefunc;
  222.   $$$$attach_photo = $$$$this->loadsource();
  223.   if($$$$attach_photo < 0) {
  224.    return $$$$attach_photo;
  225.   }
  226.   $$$$copy_photo = imagecreatetruecolor($$$$this->imginfo['width'], $$$$this->imginfo['height']);
  227.   $$$$bg = imagecolorallocate($$$$copy_photo, 255, 255, 255);
  228.   imagefill($$$$copy_photo, 0, 0, $$$$bg);
  229.   imagecopy($$$$copy_photo, $$$$attach_photo ,0, 0, 0, 0, $$$$this->imginfo['width'], $$$$this->imginfo['height']);
  230.   $$$$attach_photo = $$$$copy_photo;</P>
  231. <P>  switch($$$$this->param['thumbtype']) {
  232.    case 'fixnone':
  233.    case 1:
  234.     if($$$$this->imginfo['width'] >= $$$$this->param['thumbwidth'] || $$$$this->imginfo['height'] >= $$$$this->param['thumbheight']) {
  235.      $$$$thumb = array();
  236.      list(,,$$$$thumb['width'], $$$$thumb['height']) = $$$$this->sizevalue(0);
  237.      $$$$cx = $$$$this->imginfo['width'];
  238.      $$$$cy = $$$$this->imginfo['height'];
  239.      $$$$thumb_photo = imagecreatetruecolor($$$$thumb['width'], $$$$thumb['height']);
  240.      imagecopyresampled($$$$thumb_photo, $$$$attach_photo ,0, 0, 0, 0, $$$$thumb['width'], $$$$thumb['height'], $$$$cx, $$$$cy);
  241.     }
  242.     break;
  243.    case 'fixwr':
  244.    case 2:
  245.     if(!($$$$this->imginfo['width'] <= $$$$this->param['thumbwidth'] || $$$$this->imginfo['height'] <= $$$$this->param['thumbheight'])) {
  246.      list($$$$startx, $$$$starty, $$$$cutw, $$$$cuth) = $$$$this->sizevalue(1);
  247.      $$$$dst_photo = imagecreatetruecolor($$$$cutw, $$$$cuth);
  248.      imagecopymerge($$$$dst_photo, $$$$attach_photo, 0, 0, $$$$startx, $$$$starty, $$$$cutw, $$$$cuth, 100);
  249.      $$$$thumb_photo = imagecreatetruecolor($$$$this->param['thumbwidth'], $$$$this->param['thumbheight']);
  250.      imagecopyresampled($$$$thumb_photo, $$$$dst_photo ,0, 0, 0, 0, $$$$this->param['thumbwidth'], $$$$this->param['thumbheight'], $$$$cutw, $$$$cuth);
  251.     } else {
  252.      $$$$thumb_photo = imagecreatetruecolor($$$$this->param['thumbwidth'], $$$$this->param['thumbheight']);
  253.      $$$$bgcolor = imagecolorallocate($$$$thumb_photo, 255, 255, 255);
  254.      imagefill($$$$thumb_photo, 0, 0, $$$$bgcolor);
  255.      $$$$startx = ($$$$this->param['thumbwidth'] - $$$$this->imginfo['width']) / 2;
  256.      $$$$starty = ($$$$this->param['thumbheight'] - $$$$this->imginfo['height']) / 2;
  257.      imagecopymerge($$$$thumb_photo, $$$$attach_photo, $$$$startx, $$$$starty, 0, 0, $$$$this->imginfo['width'], $$$$this->imginfo['height'], 100);
  258.     }
  259.     break;
  260.   }
  261.   clearstatcache();
  262.   if($$$$this->imginfo['mime'] == 'image/jpeg') {
  263.    @$$$$imagefunc($$$$thumb_photo, $$$$this->target, $$$$this->param['thumbquality']);
  264.   } else {
  265.    @$$$$imagefunc($$$$thumb_photo, $$$$this->target);
  266.   }
  267.   return 1;
  268. }</P>
  269. <P> function Thumb_IM() {
  270.   global $$$$_G;</P>
  271. <P>  switch($$$$this->param['thumbtype']) {
  272.    case 'fixnone':
  273.    case 1:
  274.     if($$$$this->imginfo['width'] >= $$$$this->param['thumbwidth'] || $$$$this->imginfo['height'] >= $$$$this->param['thumbheight']) {
  275.      $$$$exec_str = $$$$this->param['imageimpath'].'/convert -quality '.intval($$$$this->param['thumbquality']).' -geometry '.$$$$this->param['thumbwidth'].'x'.$$$$this->param['thumbheight'].' '.$$$$this->source.' '.$$$$this->target;
  276.      $$$$return = $$$$this->exec($$$$exec_str);
  277.      if($$$$return < 0) {
  278.       return $$$$return;
  279.      }
  280.     }
  281.     break;
  282.    case 'fixwr':
  283.    case 2:
  284.     if(!($$$$this->imginfo['width'] <= $$$$this->param['thumbwidth'] || $$$$this->imginfo['height'] <= $$$$this->param['thumbheight'])) {
  285.      list($$$$startx, $$$$starty, $$$$cutw, $$$$cuth) = $$$$this->sizevalue(1);
  286.      $$$$exec_str = $$$$this->param['imageimpath'].'/convert -quality '.intval($$$$this->param['thumbquality']).' -crop '.$$$$cutw.'x'.$$$$cuth.'+'.$$$$startx.'+'.$$$$starty.' '.$$$$this->source.' '.$$$$this->target;
  287.      $$$$return = $$$$this->exec($$$$exec_str);
  288.      if($$$$return < 0) {
  289.       return $$$$return;
  290.      }
  291.      $$$$exec_str = $$$$this->param['imageimpath'].'/convert -quality '.intval($$$$this->param['thumbquality']).' -thumbnail \''.$$$$this->param['thumbwidth'].'x'.$$$$this->param['thumbheight'].'\' -resize '.$$$$this->param['thumbwidth'].'x'.$$$$this->param['thumbheight'].' -gravity center -extent '.$$$$this->param['thumbwidth'].'x'.$$$$this->param['thumbheight'].' '.$$$$this->target.' '.$$$$this->target;
  292.      $$$$return = $$$$this->exec($$$$exec_str);
  293.      if($$$$return < 0) {
  294.       return $$$$return;
  295.      }
  296.     } else {
  297.      $$$$startx = -($$$$this->param['thumbwidth'] - $$$$this->imginfo['width']) / 2;
  298.      $$$$starty = -($$$$this->param['thumbheight'] - $$$$this->imginfo['height']) / 2;
  299.      $$$$exec_str = $$$$this->param['imageimpath'].'/convert -quality '.intval($$$$this->param['thumbquality']).' -crop '.$$$$this->param['thumbwidth'].'x'.$$$$this->param['thumbheight'].'+'.$$$$startx.'+'.$$$$starty.' '.$$$$this->source.' '.$$$$this->target;
  300.      $$$$return = $$$$this->exec($$$$exec_str);
  301.      if($$$$return < 0) {
  302.       return $$$$return;
  303.      }
  304.      $$$$exec_str = $$$$this->param['imageimpath'].'/convert -quality '.intval($$$$this->param['thumbquality']).' -thumbnail \''.$$$$this->param['thumbwidth'].'x'.$$$$this->param['thumbheight'].'\' -gravity center -extent '.$$$$this->param['thumbwidth'].'x'.$$$$this->param['thumbheight'].' '.$$$$this->target.' '.$$$$this->target;
  305.      $$$$return = $$$$this->exec($$$$exec_str);
  306.      if($$$$return < 0) {
  307.       return $$$$return;
  308.      }
  309.     }
  310.     break;
  311.   }
  312.   return 1;
  313. }</P>
  314. <P> function Watermark_GD($$$$type = 'forum') {
  315.   global $$$$_G;</P>
  316. <P>  if(!function_exists('imagecreatetruecolor')) {
  317.    return -4;
  318.   }</P>
  319. <P>  $$$$imagefunc = &$$$$this->imagefunc;</P>
  320. <P>  if($$$$this->param['watermarktype'][$$$$type] != 'text') {
  321.    if(!function_exists('imagecopy') || !function_exists('imagecreatefrompng') || !function_exists('imagecreatefromgif') || !function_exists('imagealphablending') || !function_exists('imagecopymerge')) {
  322.     return -4;
  323.    }
  324.    $$$$watermarkinfo = @getimagesize($$$$this->param['watermarkfile'][$$$$type]);
  325.    if($$$$watermarkinfo === FALSE) {
  326.     return -3;
  327.    }
  328.    $$$$watermark_logo = $$$$this->param['watermarktype'][$$$$type] == 'png' ? @imageCreateFromPNG($$$$this->param['watermarkfile'][$$$$type]) : @imageCreateFromGIF($$$$this->param['watermarkfile'][$$$$type]);
  329.    if(!$$$$watermark_logo) {
  330.     return 0;
  331.    }
  332.    list($$$$logo_w, $$$$logo_h) = $$$$watermarkinfo;
  333.   } else {
  334.    if(!function_exists('imagettfbbox') || !function_exists('imagettftext') || !function_exists('imagecolorallocate')) {
  335.     return -4;
  336.    }
  337.    if(!class_exists('Chinese')) {
  338.     include libfile('class/chinese');
  339.    }</P>
  340. <P>   $$$$watermarktextcvt = pack("H*", $$$$this->param['watermarktext']['text'][$$$$type]);
  341.    $$$$box = imagettfbbox($$$$this->param['watermarktext']['size'][$$$$type], $$$$this->param['watermarktext']['angle'][$$$$type], $$$$this->param['watermarktext']['fontpath'][$$$$type], $$$$watermarktextcvt);
  342.    $$$$logo_h = max($$$$box[1], $$$$box[3]) - min($$$$box[5], $$$$box[7]);
  343.    $$$$logo_w = max($$$$box[2], $$$$box[4]) - min($$$$box[0], $$$$box[6]);
  344.    $$$$ax = min($$$$box[0], $$$$box[6]) * -1;
  345.    $$$$ay = min($$$$box[5], $$$$box[7]) * -1;
  346.   }
  347.   $$$$wmwidth = $$$$this->imginfo['width'] - $$$$logo_w;
  348.   $$$$wmheight = $$$$this->imginfo['height'] - $$$$logo_h;</P>
  349. <P>  if($$$$wmwidth > 10 && $$$$wmheight > 10 && !$$$$this->imginfo['animated']) {
  350.    switch($$$$this->param['watermarkstatus'][$$$$type]) {
  351.     case 1:
  352.      $$$$x = 5;
  353.      $$$$y = 5;
  354.      break;
  355.     case 2:
  356.      $$$$x = ($$$$this->imginfo['width'] - $$$$logo_w) / 2;
  357.      $$$$y = 5;
  358.      break;
  359.     case 3:
  360.      $$$$x = $$$$this->imginfo['width'] - $$$$logo_w - 5;
  361.      $$$$y = 5;
  362.      break;
  363.     case 4:
  364.      $$$$x = 5;
  365.      $$$$y = ($$$$this->imginfo['height'] - $$$$logo_h) / 2;
  366.      break;
  367.     case 5:
  368.      $$$$x = ($$$$this->imginfo['width'] - $$$$logo_w) / 2;
  369.      $$$$y = ($$$$this->imginfo['height'] - $$$$logo_h) / 2;
  370.      break;
  371.     case 6:
  372.      $$$$x = $$$$this->imginfo['width'] - $$$$logo_w;
  373.      $$$$y = ($$$$this->imginfo['height'] - $$$$logo_h) / 2;
  374.      break;
  375.     case 7:
  376.      $$$$x = 5;
  377.      $$$$y = $$$$this->imginfo['height'] - $$$$logo_h - 5;
  378.      break;
  379.     case 8:
  380.      $$$$x = ($$$$this->imginfo['width'] - $$$$logo_w) / 2;
  381.      $$$$y = $$$$this->imginfo['height'] - $$$$logo_h - 5;
  382.      break;
  383.     case 9:
  384.      $$$$x = $$$$this->imginfo['width'] - $$$$logo_w - 5;
  385.      $$$$y = $$$$this->imginfo['height'] - $$$$logo_h - 5;
  386.      break;
  387.    }
  388.    if($$$$this->imginfo['mime'] != 'image/png') {
  389.     $$$$color_photo = imagecreatetruecolor($$$$this->imginfo['width'], $$$$this->imginfo['height']);
  390.    }
  391.    $$$$dst_photo = $$$$this->loadsource();
  392.    if($$$$dst_photo < 0) {
  393.     return $$$$dst_photo;
  394.    }
  395.    imagealphablending($$$$dst_photo, true);
  396.    imagesavealpha($$$$dst_photo, true);
  397.    if($$$$this->imginfo['mime'] != 'image/png') {
  398.     imageCopy($$$$color_photo, $$$$dst_photo, 0, 0, 0, 0, $$$$this->imginfo['width'], $$$$this->imginfo['height']);
  399.     $$$$dst_photo = $$$$color_photo;
  400.    }
  401.    if($$$$this->param['watermarktype'][$$$$type] == 'png') {
  402.     imageCopy($$$$dst_photo, $$$$watermark_logo, $$$$x, $$$$y, 0, 0, $$$$logo_w, $$$$logo_h);
  403.    } elseif($$$$this->param['watermarktype'][$$$$type] == 'text') {
  404.     if(($$$$this->param['watermarktext']['shadowx'][$$$$type] || $$$$this->param['watermarktext']['shadowy'][$$$$type]) && $$$$this->param['watermarktext']['shadowcolor'][$$$$type]) {
  405.      $$$$shadowcolorrgb = explode(',', $$$$this->param['watermarktext']['shadowcolor'][$$$$type]);
  406.      $$$$shadowcolor = imagecolorallocate($$$$dst_photo, $$$$shadowcolorrgb[0], $$$$shadowcolorrgb[1], $$$$shadowcolorrgb[2]);
  407.      imagettftext($$$$dst_photo, $$$$this->param['watermarktext']['size'][$$$$type], $$$$this->param['watermarktext']['angle'][$$$$type], $$$$x + $$$$ax + $$$$this->param['watermarktext']['shadowx'][$$$$type], $$$$y + $$$$ay + $$$$this->param['watermarktext']['shadowy'][$$$$type], $$$$shadowcolor, $$$$this->param['watermarktext']['fontpath'][$$$$type], $$$$watermarktextcvt);
  408.     }</P>
  409. <P>    $$$$colorrgb = explode(',', $$$$this->param['watermarktext']['color'][$$$$type]);
  410.     $$$$color = imagecolorallocate($$$$dst_photo, $$$$colorrgb[0], $$$$colorrgb[1], $$$$colorrgb[2]);
  411.     imagettftext($$$$dst_photo, $$$$this->param['watermarktext']['size'][$$$$type], $$$$this->param['watermarktext']['angle'][$$$$type], $$$$x + $$$$ax, $$$$y + $$$$ay, $$$$color, $$$$this->param['watermarktext']['fontpath'][$$$$type], $$$$watermarktextcvt);
  412.    } else {
  413.     imageAlphaBlending($$$$watermark_logo, true);
  414.     imageCopyMerge($$$$dst_photo, $$$$watermark_logo, $$$$x, $$$$y, 0, 0, $$$$logo_w, $$$$logo_h, $$$$this->param['watermarktrans'][$$$$type]);
  415.    }</P>
  416. <P>   clearstatcache();
  417.    if($$$$this->imginfo['mime'] == 'image/jpeg') {
  418.     @$$$$imagefunc($$$$dst_photo, $$$$this->target, $$$$this->param['watermarkquality'][$$$$type]);
  419.    } else {
  420.     @$$$$imagefunc($$$$dst_photo, $$$$this->target);
  421.    }
  422.   }
  423.   return 1;
  424. }</P>
  425. <P> function Watermark_IM($$$$type = 'forum') {
  426.   global $$$$_G;</P>
  427. <P>  switch($$$$this->param['watermarkstatus'][$$$$type]) {
  428.    case 1:
  429.     $$$$gravity = 'NorthWest';
  430.     break;
  431.    case 2:
  432.     $$$$gravity = 'North';
  433.     break;
  434.    case 3:
  435.     $$$$gravity = 'NorthEast';
  436.     break;
  437.    case 4:
  438.     $$$$gravity = 'West';
  439.     break;
  440.    case 5:
  441.     $$$$gravity = 'Center';
  442.     break;
  443.    case 6:
  444.     $$$$gravity = 'East';
  445.     break;
  446.    case 7:
  447.     $$$$gravity = 'SouthWest';
  448.     break;
  449.    case 8:
  450.     $$$$gravity = 'South';
  451.     break;
  452.    case 9:
  453.     $$$$gravity = 'SouthEast';
  454.     break;
  455.   }</P>
  456. <P>  if($$$$this->param['watermarktype'][$$$$type] != 'text') {
  457.    $$$$exec_str = $$$$this->param['imageimpath'].'/composite'.
  458.     ($$$$this->param['watermarktype'][$$$$type] != 'png' && $$$$this->param['watermarktrans'][$$$$type] != '100' ? ' -watermark '.$$$$this->param['watermarktrans'][$$$$type] : '').
  459.     ' -quality '.$$$$this->param['watermarkquality'][$$$$type].
  460.     ' -gravity '.$$$$gravity.
  461.     ' '.$$$$this->param['watermarkfile'][$$$$type].' '.$$$$this->source.' '.$$$$this->target;
  462.   } else {
  463.    $$$$watermarktextcvt = str_replace(array("\n", "\r", "'"), array('', '', '\''), pack("H*", $$$$this->param['watermarktext']['text'][$$$$type]));
  464.    $$$$angle = -$$$$this->param['watermarktext']['angle'][$$$$type];
  465.    $$$$translate = $$$$this->param['watermarktext']['translatex'][$$$$type] || $$$$this->param['watermarktext']['translatey'][$$$$type] ? ' translate '.$$$$this->param['watermarktext']['translatex'][$$$$type].','.$$$$this->param['watermarktext']['translatey'][$$$$type] : '';
  466.    $$$$skewX = $$$$this->param['watermarktext']['skewx'][$$$$type] ? ' skewX '.$$$$this->param['watermarktext']['skewx'][$$$$type] : '';
  467.    $$$$skewY = $$$$this->param['watermarktext']['skewy'][$$$$type] ? ' skewY '.$$$$this->param['watermarktext']['skewy'][$$$$type] : '';
  468.    $$$$exec_str = $$$$this->param['imageimpath'].'/convert'.
  469.     ' -quality '.$$$$this->param['watermarkquality'][$$$$type].
  470.     ' -font "'.$$$$this->param['watermarktext']['fontpath'][$$$$type].'"'.
  471.     ' -pointsize '.$$$$this->param['watermarktext']['size'][$$$$type].
  472.     (($$$$this->param['watermarktext']['shadowx'][$$$$type] || $$$$this->param['watermarktext']['shadowy'][$$$$type]) && $$$$this->param['watermarktext']['shadowcolor'][$$$$type] ?
  473.      ' -fill "rgb('.$$$$this->param['watermarktext']['shadowcolor'][$$$$type].')"'.
  474.      ' -draw "'.
  475.       ' gravity '.$$$$gravity.$$$$translate.$$$$skewX.$$$$skewY.
  476.       ' rotate '.$$$$angle.
  477.       ' text '.$$$$this->param['watermarktext']['shadowx'][$$$$type].','.$$$$this->param['watermarktext']['shadowy'][$$$$type].' \''.$$$$watermarktextcvt.'\'"' : '').
  478.     ' -fill "rgb('.$$$$this->param['watermarktext']['color'][$$$$type].')"'.
  479.     ' -draw "'.
  480.      ' gravity '.$$$$gravity.$$$$translate.$$$$skewX.$$$$skewY.
  481.      ' rotate '.$$$$angle.
  482.      ' text 0,0 \''.$$$$watermarktextcvt.'\'"'.
  483.     ' '.$$$$this->source.' '.$$$$this->target;
  484.   }
  485.   return $$$$this->exec($$$$exec_str);
  486. }</P>
  487. <P>}
  488. </P>
复制代码
回复

使用道具 举报

66061923 发表于 2013-4-6 18:49:44 | 显示全部楼层
不是太多数人的要求吧,站长不会为个别客户的要求而做改动的哦。
回复

使用道具 举报

8974516 发表于 2013-4-6 23:37:05 | 显示全部楼层
楼上这是发的什么东西
回复

使用道具 举报

szruis 发表于 2013-4-8 07:59:19 | 显示全部楼层
这个确实需要,把一个论坛分割为多个小论坛来运营是非常有用的。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-5-16 19:26 , Processed in 0.045173 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表