PHP add watermark to picture three

Source: Internet
Author: User
Tags add watermark to picture

?

function setmasktxtpct ($n)
{
$this->mask_txt_pct = (int) $n;
}

/**
* Set thumbnail border
*
* @param (type) (parameter name) (description)
*/
function Setdstimgborder ($size =1, $color = "#000000")
{
$this->img_border_size = (int) $size;
$this->img_border_color = $color;
}

/**
* Flip Horizontally
*/
function Fliph ()
{
$this->_flip_x++;
}

/**
* Flip Vertically
*/
function FLIPV ()
{
$this->_flip_y++;
}

/**
* Set the Cut type
*
* @param (type) (parameter name) (description)
*/
function Setcuttype ($type)
{
$this->cut_type = (int) $type;
}

/**
* Set Picture Cut
*
* @param integer $width rectangular Shearing
*/
function Setrectanglecut ($width, $height)
{
$this->fill_w = (int) $width;
$this->fill_h = (int) $height;
}

/**
* Set the source diagram to cut the starting coordinate point
*
* @param (type) (parameter name) (description)
*/
function Setsrccutposition ($x, $y)
{
$this->src_x = (int) $x;
$this->src_y = (int) $y;
}

/**
* Create picture, main function
* @param integer $a this parameter is used as a percentage when the second parameter is missing.
* Otherwise as width value
* @param integer $b The height of the picture after scaling
*/
function createimg ($a, $b =null)
{
$num = Func_num_args ();
if (1 = $num)
{
$r = (int) $a;
if ($r < 1)
{
Die ("Picture scaling must not be less than 1");
}
$this->img_scale = $r;
$this->_setnewimgsize ($R);
}

if (2 = $num)
{
$w = (int) $a;
$h = (int) $b;
if (0 = $w)
{
Die ("target width cannot be 0");
}
if (0 = $h)
{
Die ("target height cannot be 0");
}
$this->_setnewimgsize ($w, $h);
}

if ($this->_flip_x%2!=0)
{
$this->_fliph ($this->h_src);
}

if ($this->_flip_y%2!=0)
{
$this-&GT;_FLIPV ($this->h_src);
}
$this->_createmask ();
$this->_output ();

Release
if (Imagedestroy ($this->h_src) && Imagedestroy ($this->h_dst))
{
return true;
}
Else
{
return false;
}
}

?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.