<?
function setMaskTxtPct($n)
{
$this->mask_txt_pct = (int)$n;
}
/**
* 設定縮圖邊框
*
* @param (類型) (參數名) (描述)
*/
function setDstImgBorder($size=1, $color="#000000")
{
$this->img_border_size = (int)$size;
$this->img_border_color = $color;
}
/**
* 水平翻轉
*/
function flipH()
{
$this->_flip_x++;
}
/**
* 垂直翻轉
*/
function flipV()
{
$this->_flip_y++;
}
/**
* 設定剪下類型
*
* @param (類型) (參數名) (描述)
*/
function setCutType($type)
{
$this->cut_type = (int)$type;
}
/**
* 設定圖片剪下
*
* @param integer $width 矩形剪下
*/
function setRectangleCut($width, $height)
{
$this->fill_w = (int)$width;
$this->fill_h = (int)$height;
}
/**
* 設定源圖剪下起始座標點
*
* @param (類型) (參數名) (描述)
*/
function setSrcCutPosition($x, $y)
{
$this->src_x = (int)$x;
$this->src_y = (int)$y;
}
/**
* 建立圖片,主函數
* @param integer $a 當缺少第二個參數時,此參數將用作百分比,
* 否則作為寬度值
* @param integer $b 圖片縮放後的高度
*/
function createImg($a, $b=null)
{
$num = func_num_args();
if(1 == $num)
{
$r = (int)$a;
if($r < 1)
{
die("圖片縮放比例不得小於1");
}
$this->img_scale = $r;
$this->_setNewImgSize($r);
}
if(2 == $num)
{
$w = (int)$a;
$h = (int)$b;
if(0 == $w)
{
die("目標寬度不能為0");
}
if(0 == $h)
{
die("目標高度不能為0");
}
$this->_setNewImgSize($w, $h);
}
if($this->_flip_x%2!=0)
{
$this->_flipH($this->h_src);
}
if($this->_flip_y%2!=0)
{
$this->_flipV($this->h_src);
}
$this->_createMask();
$this->_output();
// 釋放
if(imagedestroy($this->h_src) && imagedestroy($this->h_dst))
{
Return true;
}
else
{
Return false;
}
}
?>