瀏覽代碼

图片处理类命名规范

tags/6.2.11
tianya 1 年之前
父節點
當前提交
4c3922105c
共有 3 個文件被更改,包括 13 次插入9 次删除
  1. +8
    -4
      src/system/dedeimage.class.php
  2. +3
    -3
      src/system/dedetemplate.class.php
  3. +2
    -2
      src/system/helpers/image.helper.php

src/system/image.class.php → src/system/dedeimage.class.php 查看文件

@@ -3,13 +3,13 @@ if (!defined('DEDEINC')) exit ('dedebiz');
/** /**
* 图像处理 * 图像处理
* *
* @version $id:image.class.php 18:10 2010年7月5日 tianya $
* @version $id:dedeimage.class.php 18:10 2010年7月5日 tianya $
* @package DedeBIZ.Libraries * @package DedeBIZ.Libraries
* @copyright Copyright (c) 2022 DedeBIZ.COM * @copyright Copyright (c) 2022 DedeBIZ.COM
* @license GNU GPL v2 (https://www.dedebiz.com/license) * @license GNU GPL v2 (https://www.dedebiz.com/license)
* @link https://www.dedebiz.com * @link https://www.dedebiz.com
*/ */
class image
class DedeImage
{ {
var $attachinfo; var $attachinfo;
var $targetfile; //图片路径 var $targetfile; //图片路径
@@ -21,8 +21,12 @@ class image
var $watermarktext; var $watermarktext;
var $thumbstatus; var $thumbstatus;
var $watermarkstatus; var $watermarkstatus;
var $watermarkminwidth;
var $watermarkminheight;
var $watermarktype;
var $watermarktrans;
//析构函数,兼容PHP4 //析构函数,兼容PHP4
function image($targetfile, $cfg_thumb, $cfg_watermarktext, $photo_waterpos, $photo_diaphaneity, $photo_wheight, $photo_wwidth, $cfg_watermarktype, $photo_marktrans, $trueMarkimg, $attach = array())
function DedeImage($targetfile, $cfg_thumb, $cfg_watermarktext, $photo_waterpos, $photo_diaphaneity, $photo_wheight, $photo_wwidth, $cfg_watermarktype, $photo_marktrans, $trueMarkimg, $attach = array())
{ {
$this->__construct($targetfile, $cfg_thumb, $cfg_watermarktext, $photo_waterpos, $photo_diaphaneity, $photo_wheight, $photo_wwidth, $cfg_watermarktype, $photo_marktrans, $trueMarkimg, $attach); $this->__construct($targetfile, $cfg_thumb, $cfg_watermarktext, $photo_waterpos, $photo_diaphaneity, $photo_wheight, $photo_wwidth, $cfg_watermarktype, $photo_marktrans, $trueMarkimg, $attach);
} }
@@ -76,7 +80,7 @@ class image
{ {
$this->thumb_gd($thumbwidth, $thumbheight, $preview); $this->thumb_gd($thumbwidth, $thumbheight, $preview);
if ($this->thumbstatus == 2 && $this->watermarkstatus) { if ($this->thumbstatus == 2 && $this->watermarkstatus) {
$this->image(
$this->DedeImage(
$this->targetfile, $this->targetfile,
$this->attach, $this->attach,
$this->watermarktext, $this->watermarktext,

+ 3
- 3
src/system/dedetemplate.class.php 查看文件

@@ -30,7 +30,7 @@ function MakePublicTag($atts = array(), $refObj = '', $fields = array())
* *
* @access public * @access public
* @param array $atts 属性 * @param array $atts 属性
* @param array $attlist 属性列表
* @param string $attlist 属性列表
* @return void * @return void
*/ */
function FillAtts(&$atts, $attlist="") function FillAtts(&$atts, $attlist="")
@@ -485,7 +485,7 @@ class DedeTemplate
return; return;
} }
$cAtt = new TagAttributeParse(); $cAtt = new TagAttributeParse();
$cAtt->CharToLow = TRUE;
$cAtt->charToLow = TRUE;
//遍历模板字符串,请取标记及其属性信息 //遍历模板字符串,请取标记及其属性信息
$t = 0; $t = 0;
$preTag = ''; $preTag = '';
@@ -883,7 +883,7 @@ class DedeTemplate
* 编译if标记 * 编译if标记
* *
* @access public * @access public
* @param string $cTag 标签
* @param object $cTag 标签
* @return string * @return string
*/ */
function Compilerif ($cTag) function Compilerif ($cTag)


+ 2
- 2
src/system/helpers/image.helper.php 查看文件

@@ -76,7 +76,7 @@ if (!function_exists('WaterImg')) {
function WaterImg($srcFile, $fromGo = 'up') function WaterImg($srcFile, $fromGo = 'up')
{ {
include(DEDEDATA.'/mark/inc_photowatermark_config.php'); include(DEDEDATA.'/mark/inc_photowatermark_config.php');
require_once(DEDEINC.'/image.class.php');
require_once(DEDEINC.'/dedeimage.class.php');
if (isset($GLOBALS['needwatermark'])) { if (isset($GLOBALS['needwatermark'])) {
$photo_markup = $photo_markdown = empty($GLOBALS['needwatermark']) ? '0' : '1'; $photo_markup = $photo_markdown = empty($GLOBALS['needwatermark']) ? '0' : '1';
} }
@@ -119,7 +119,7 @@ if (!function_exists('WaterImg')) {
$cfg_watermarktext['shadowy'] = '0'; $cfg_watermarktext['shadowy'] = '0';
$cfg_watermarktext['shadowcolor'] = '0,0,0'; $cfg_watermarktext['shadowcolor'] = '0,0,0';
$photo_marktrans = 85; $photo_marktrans = 85;
$img = new image($srcFile, 0, $cfg_watermarktext, $photo_waterpos, $photo_diaphaneity, $photo_wheight, $photo_wwidth, $photo_marktype, $photo_marktrans, $TRUEMarkimg);
$img = new DedeImage($srcFile, 0, $cfg_watermarktext, $photo_waterpos, $photo_diaphaneity, $photo_wheight, $photo_wwidth, $photo_marktype, $photo_marktrans, $TRUEMarkimg);
$img->watermark(0); $img->watermark(0);
} }
} }


Loading…
取消
儲存