国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sys_info_mark.php 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * 图片水印
  4. *
  5. * @version $Id: sys_info_mark.php 1 22:28 2010年7月20日Z tianya $
  6. * @package DedeCMS.Administrator
  7. * @copyright Copyright (c) 2020, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__)."/config.php");
  12. CheckPurview('sys_Edit');
  13. require_once(DEDEINC."/image.func.php");
  14. if($cfg_photo_support=='')
  15. {
  16. echo "你的系统没安装GD库,不允许使用本功能!";
  17. exit();
  18. }
  19. $ImageWaterConfigFile = DEDEDATA."/mark/inc_photowatermark_config.php";
  20. if(empty($action)) $action = "";
  21. $allow_mark_types = array(
  22. 'image/gif',
  23. 'image/xpng',
  24. 'image/png',
  25. );
  26. if($action=="save")
  27. {
  28. $vars = array('photo_markup','photo_markdown','photo_marktype','photo_wwidth','photo_wheight','photo_waterpos','photo_watertext','photo_fontsize','photo_fontcolor','photo_marktrans','photo_diaphaneity');
  29. $configstr = $shortname = "";
  30. foreach($vars as $v)
  31. {
  32. ${$v} = str_replace("'", "", ${'get_'.$v});
  33. $configstr .= "\${$v} = '".${$v}."';\r\n";
  34. }
  35. if(is_uploaded_file($newimg))
  36. {
  37. $imgfile_type = strtolower(trim($newimg_type));
  38. if(!in_array($imgfile_type, $allow_mark_types))
  39. {
  40. ShowMsg("上传的图片格式错误,请使用 gif、png格式的其中一种!","-1");
  41. exit();
  42. }
  43. if($imgfile_type=='image/xpng' || $imgfile_type=='image/png')
  44. {
  45. $shortname = ".png";
  46. }
  47. else if($imgfile_type=='image/gif')
  48. {
  49. $shortname = ".gif";
  50. }
  51. else
  52. {
  53. ShowMsg("水印图片仅支持gif、png格式的其中一种!","-1");
  54. exit;
  55. }
  56. $photo_markimg = 'mark'.$shortname;
  57. @move_uploaded_file($newimg,DEDEDATA."/mark/".$photo_markimg);
  58. }
  59. $configstr .= "\$photo_markimg = '{$photo_markimg}';\r\n";
  60. $configstr = "<"."?php\r\n".$configstr."?".">\r\n";
  61. $fp = fopen($ImageWaterConfigFile,"w") or die("写入文件 $ImageWaterConfigFile 失败,请检查权限!");
  62. fwrite($fp,$configstr);
  63. fclose($fp);
  64. echo "<script>alert('修改配置成功!');</script>\r\n";
  65. }
  66. require_once($ImageWaterConfigFile);
  67. include DedeInclude('templets/sys_info_mark.htm');