本文整理汇总了PHP中ImagickPixel::destroy方法的典型用法代码示例。如果您正苦于以下问题:PHP ImagickPixel::destroy方法的具体用法?PHP ImagickPixel::destroy怎么用?PHP ImagickPixel::destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImagickPixel
的用法示例。
在下文中一共展示了ImagickPixel::destroy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: watermarkText
//.........这里部分代码省略.........
}
// if start x or y is NOT number, find the real position of start x or y from word left, center, right, top, middle, bottom
if (!is_numeric($wm_txt_start_x) || !is_numeric($wm_txt_start_y)) {
if (!is_numeric($wm_txt_start_x)) {
switch (strtolower($wm_txt_start_x)) {
case 'center':
$image_width = $this->Imagick->getImageWidth();
$watermark_width = $wm_txt_width;
$wm_txt_start_x = $this->calculateStartXOfCenter($watermark_width, $image_width);
unset($image_width, $watermark_width);
break;
case 'right':
$image_width = $this->Imagick->getImageWidth();
$wm_txt_start_x = intval($image_width - $wm_txt_width) - 5;
// minus 5 because Imagick is different from GD.
unset($image_width);
break;
case 'left':
default:
$wm_txt_start_x = 10;
// Imagick is different from GD, so increase it.
break;
}
}
if (!is_numeric($wm_txt_start_y)) {
switch (strtolower($wm_txt_start_y)) {
case 'middle':
$image_height = $this->Imagick->getImageHeight();
$watermark_height = $wm_txt_height;
$wm_txt_start_y = $this->calculateStartXOfCenter($watermark_height, $image_height);
unset($image_height, $watermark_height);
break;
case 'bottom':
$image_height = $this->Imagick->getImageHeight();
if ($image_height - ($wm_txt_height + 5) > '0') {
$wm_txt_start_y = intval($image_height - ($wm_txt_height + 5));
} else {
$wm_txt_start_y = intval($image_height - $wm_txt_height);
}
unset($image_height);
break;
case 'top':
default:
$wm_txt_start_y = 10;
// Imagick is different from GD, so increase it.
break;
}
}
}
// begins watermark text --------------------------------------------------------------------------------------------
// set color
$black = new \ImagickPixel('black');
$white = new \ImagickPixel('white');
$transwhite = new \ImagickPixel('rgba(255, 255, 255, 0)');
// set color transparent white
$transwhitetext = new \ImagickPixel('rgba(255, 255, 255, ' . $this->convertAlpha127ToRgba($wm_txt_font_alpha) . ')');
if (!isset(${$wm_txt_font_color})) {
$wm_txt_font_color = 'transwhitetext';
}
// fill font color
$ImagickDraw->setFillColor(${$wm_txt_font_color});
// write text on image
if ($this->source_image_frames > 1) {
// if source image is animated gif
$this->Imagick = $this->Imagick->coalesceImages();
if (is_object($this->Imagick)) {
$i = 1;
foreach ($this->Imagick as $Frame) {
$Frame->annotateImage($ImagickDraw, $wm_txt_start_x, $wm_txt_start_y, 0, $wm_txt_text);
$Frame->setImagePage(0, 0, 0, 0);
if ($i == 1) {
$this->ImagickFirstFrame = $Frame->getImage();
}
$i++;
}
unset($Frame, $i);
}
} else {
$this->Imagick->annotateImage($ImagickDraw, $wm_txt_start_x, $wm_txt_start_y, 0, $wm_txt_text);
if ($this->source_image_type == '1') {
// if source image is gif, set image page to prevent sizing error.
$this->Imagick->setImagePage(0, 0, 0, 0);
}
$this->ImagickFirstFrame = null;
}
// end watermark text -----------------------------------------------------------------------------------------------
$ImagickDraw->clear();
$black->destroy();
$transwhite->destroy();
$transwhitetext->destroy();
$white->destroy();
unset($black, $ImagickDraw, $transwhite, $transwhitetext, $white, $wm_txt_height, $wm_txt_width);
$this->destination_image_height = $this->Imagick->getImageHeight();
$this->destination_image_width = $this->Imagick->getImageWidth();
$this->source_image_height = $this->destination_image_height;
$this->source_image_width = $this->destination_image_width;
$this->status = true;
$this->status_msg = null;
return true;
}
示例2: Imagick
<?php
$im = new Imagick();
$im->clear();
$im->destroy();
$im = new ImagickDraw();
$im->clear();
$im->destroy();
$im = new ImagickPixel();
$im->clear();
$im->destroy();
$magick = new Imagick('magick:rose');
$im = new ImagickPixelIterator($magick);
$im->clear();
$im->destroy();
echo 'success';