国内流行的内容管理系统(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.

60 lines
2.3KB

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