当前位置: 首页>>代码示例>>PHP>>正文


PHP imageCopyMerge函数代码示例

本文整理汇总了PHP中imageCopyMerge函数的典型用法代码示例。如果您正苦于以下问题:PHP imageCopyMerge函数的具体用法?PHP imageCopyMerge怎么用?PHP imageCopyMerge使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了imageCopyMerge函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createCharImages

 /**
  * Creates an image for every code character.
  */
 protected function createCharImages()
 {
     $counter = 0;
     for ($i = 0, $j = strlen($this->codeWord); $i < $j; $i++) {
         $char = $this->codeWord[$i];
         $tempImageWidth = $this->fontSize * 2;
         $tempImageHeight = $this->fontSize + 40;
         // create image
         $tempImage = imageCreate($tempImageWidth, $tempImageHeight);
         $tempColor = imageColorAllocate($tempImage, $this->color2['red'], $this->color2['green'], $this->color2['blue']);
         imageColorTransparent($tempImage, $tempColor);
         // set font color
         $fontColor = imageColorAllocate($tempImage, $this->fontColor['red'], $this->fontColor['green'], $this->fontColor['blue']);
         // write text
         imageTtfText($tempImage, $this->fontSize, 0, 10, $this->fontSize + mt_rand(25, 30), $fontColor, $this->fontFace, $char);
         // morph text
         if (CAPTCHA_FONT_MORPH) {
             $tempImageHeight = 120;
             $tempImage2 = imageCreate($tempImageWidth, 120);
             $tempColor = imageColorAllocate($tempImage2, $this->color2['red'], $this->color2['green'], $this->color2['blue']);
             imageColorTransparent($tempImage2, $tempColor);
             $divisor = mt_rand(6, 7);
             $quotient = mt_rand(4, 6);
             $method = mt_rand(0, 1);
             // morph text on x-axis
             if ($method == 0) {
                 for ($y = 1; $y <= $tempImageHeight; $y++) {
                     $posX = sin($y / $divisor) * $quotient;
                     imageCopyMerge($tempImage2, $tempImage, $posX, $y, 0, $y, $tempImageWidth, 1, 100);
                 }
             }
             // morph text on y-axis
             if ($method == 1) {
                 for ($x = 1; $x <= $tempImageWidth; $x++) {
                     $posY = sin($x / $divisor) * $quotient;
                     imageCopyMerge($tempImage2, $tempImage, $x, $posY, $x, 0, 1, $tempImageHeight, 100);
                 }
             }
             $image = $tempImage2;
         } else {
             $image = $tempImage;
         }
         // get text width and height
         $positionX = 0;
         for ($x = $tempImageWidth - 1; $x > 0; $x--) {
             for ($y = $tempImageHeight - 1; $y > 0; $y--) {
                 $color = imageColorAt($image, $x, $y);
                 $colorArray = imageColorsForIndex($image, $color);
                 if ($colorArray['red'] == $this->fontColor['red'] && $colorArray['green'] == $this->fontColor['green'] && $colorArray['blue'] == $this->fontColor['blue']) {
                     $positionX = $x;
                     $x = 0;
                     $y = 0;
                     break;
                 }
             }
         }
         $width = $positionX + 10;
         $height = 100;
         // create final char image
         $this->chars[$counter] = imageCreate($width, $height);
         $color2 = imageColorAllocate($this->chars[$counter], $this->color2['red'], $this->color2['green'], $this->color2['blue']);
         imageColorTransparent($this->chars[$counter], $color2);
         imageCopyMerge($this->chars[$counter], $image, 5, 5, 0, 0, $width, $tempImageHeight, 100);
         $this->charWidth[$counter] = $width;
         // destroy temp images
         imageDestroy($tempImage);
         if (CAPTCHA_FONT_MORPH) {
             imageDestroy($tempImage2);
         }
         $counter++;
     }
 }
开发者ID:joaocustodio,项目名称:EmuDevstore-1,代码行数:75,代码来源:CaptchaImage.class.php

示例2: marcaDagua

 private function marcaDagua()
 {
     // Obtém o cabeçalho de ambas as imagens
     // http://br3.php.net/manual/pt_BR/function.imagecreatefrompng.php
     $cab_marca = imagecreatefrompng($this->img_marca);
     // http://br3.php.net/manual/pt_BR/function.imagecreatefromjpeg.php
     $cab_imagem = imagecreatefromjpeg($this->pasta . "/" . $this->nome);
     // Obtém os tamanhos de ambas as imagens
     // http://br3.php.net/manual/pt_BR/function.getimagesize.php
     $tam_imagem = getimagesize($this->pasta . "/" . $this->nome);
     $tam_marca = getimagesize($this->img_marca);
     $largura_img = $tam_imagem[0];
     $altura_img = $tam_imagem[1];
     $largura_marca = $tam_marca[0];
     $altura_marca = $tam_marca[1];
     // Aqui, defini-se a posição onde a marca deve aparecer na foto: Rodapé Direito
     $eixo_x = $largura_img - $largura_marca - 5;
     $eixo_y = $altura_img - $altura_marca - 5;
     // http://br3.php.net/manual/pt_BR/function.imagecolortransparent.php
     // http://br3.php.net/manual/pt_BR/function.imagecolorallocate.php
     imagecolortransparent($cab_marca, imagecolorallocate($cab_marca, 4, 137, 193));
     // A função principal: misturar as duas imagens
     imageCopyMerge($cab_imagem, $cab_marca, $eixo_x, $eixo_y, 0, 0, $largura_marca, $altura_marca, 50);
     // Cria a imagem com a marca da agua
     // http://br3.php.net/manual/pt_BR/function.getimagesize.php
     imagejpeg($cab_imagem, $this->pasta . "/" . $this->nome, 90);
 }
开发者ID:LeoPeres,项目名称:POO,代码行数:27,代码来源:upload.class.php

示例3: waterMark

function waterMark($fileInHD, $wmFile, $transparency = 50, $jpegQuality = 90, $margin = 5)
{
    $wmImg = imageCreateFromJPEG($wmFile);
    $jpegImg = imageCreateFromJPEG($fileInHD);
    // Water mark random position
    $wmX = (bool) rand(0, 1) ? $margin : imageSX($jpegImg) - imageSX($wmImg) - $margin;
    $wmY = (bool) rand(0, 1) ? $margin : imageSY($jpegImg) - imageSY($wmImg) - $margin;
    // Water mark process
    imageCopyMerge($jpegImg, $wmImg, $wmX, $wmY, 0, 0, imageSX($wmImg), imageSY($wmImg), $transparency);
    // Overwriting image
    ImageJPEG($jpegImg, $fileInHD, $jpegQuality);
}
开发者ID:ZSShang,项目名称:mylearn,代码行数:12,代码来源:testgd2.php

示例4: Watermark_GD

 function Watermark_GD($preview = 0)
 {
     global $watermarkstatus, $watermarktype, $watermarktrans, $watermarkquality, $watermarktext;
     $watermarkstatus = $GLOBALS['forum']['disablewatermark'] ? 0 : $watermarkstatus;
     if ($watermarkstatus && function_exists('imagecopy') && function_exists('imagealphablending') && function_exists('imagecopymerge')) {
         $imagecreatefromfunc = $this->imagecreatefromfunc;
         $imagefunc = $this->imagefunc;
         list($img_w, $img_h) = $this->attachinfo;
         if ($watermarktype < 2) {
             $watermark_file = $watermarktype == 1 ? './images/common/watermark.png' : './images/common/watermark.gif';
             $watermarkinfo = @getimagesize($watermark_file);
             $watermark_logo = $watermarktype == 1 ? @imageCreateFromPNG($watermark_file) : @imageCreateFromGIF($watermark_file);
             if (!$watermark_logo) {
                 return;
             }
             list($logo_w, $logo_h) = $watermarkinfo;
         } else {
             $watermarktextcvt = pack("H*", $watermarktext['text']);
             $box = imagettfbbox($watermarktext['size'], $watermarktext['angle'], $watermarktext['fontpath'], $watermarktextcvt);
             $logo_h = max($box[1], $box[3]) - min($box[5], $box[7]);
             $logo_w = max($box[2], $box[4]) - min($box[0], $box[6]);
             $ax = min($box[0], $box[6]) * -1;
             $ay = min($box[5], $box[7]) * -1;
         }
         $wmwidth = $img_w - $logo_w;
         $wmheight = $img_h - $logo_h;
         if (($watermarktype < 2 && is_readable($watermark_file) || $watermarktype == 2) && $wmwidth > 10 && $wmheight > 10 && !$this->animatedgif) {
             switch ($watermarkstatus) {
                 case 1:
                     $x = +5;
                     $y = +5;
                     break;
                 case 2:
                     $x = ($img_w - $logo_w) / 2;
                     $y = +5;
                     break;
                 case 3:
                     $x = $img_w - $logo_w - 5;
                     $y = +5;
                     break;
                 case 4:
                     $x = +5;
                     $y = ($img_h - $logo_h) / 2;
                     break;
                 case 5:
                     $x = ($img_w - $logo_w) / 2;
                     $y = ($img_h - $logo_h) / 2;
                     break;
                 case 6:
                     $x = $img_w - $logo_w;
                     $y = ($img_h - $logo_h) / 2;
                     break;
                 case 7:
                     $x = +5;
                     $y = $img_h - $logo_h - 5;
                     break;
                 case 8:
                     $x = ($img_w - $logo_w) / 2;
                     $y = $img_h - $logo_h - 5;
                     break;
                 case 9:
                     $x = $img_w - $logo_w - 5;
                     $y = $img_h - $logo_h - 5;
                     break;
             }
             $dst_photo = imagecreatetruecolor($img_w, $img_h);
             $target_photo = @$imagecreatefromfunc($this->targetfile);
             imageCopy($dst_photo, $target_photo, 0, 0, 0, 0, $img_w, $img_h);
             if ($watermarktype == 1) {
                 imageCopy($dst_photo, $watermark_logo, $x, $y, 0, 0, $logo_w, $logo_h);
             } elseif ($watermarktype == 2) {
                 if (($watermarktext['shadowx'] || $watermarktext['shadowy']) && $watermarktext['shadowcolor']) {
                     $shadowcolorrgb = explode(',', $watermarktext['shadowcolor']);
                     $shadowcolor = imagecolorallocate($dst_photo, $shadowcolorrgb[0], $shadowcolorrgb[1], $shadowcolorrgb[2]);
                     imagettftext($dst_photo, $watermarktext['size'], $watermarktext['angle'], $x + $ax + $watermarktext['shadowx'], $y + $ay + $watermarktext['shadowy'], $shadowcolor, $watermarktext['fontpath'], $watermarktextcvt);
                 }
                 $colorrgb = explode(',', $watermarktext['color']);
                 $color = imagecolorallocate($dst_photo, $colorrgb[0], $colorrgb[1], $colorrgb[2]);
                 imagettftext($dst_photo, $watermarktext['size'], $watermarktext['angle'], $x + $ax, $y + $ay, $color, $watermarktext['fontpath'], $watermarktextcvt);
             } else {
                 imageAlphaBlending($watermark_logo, true);
                 imageCopyMerge($dst_photo, $watermark_logo, $x, $y, 0, 0, $logo_w, $logo_h, $watermarktrans);
             }
             $targetfile = !$preview ? $this->targetfile : DISCUZ_ROOT . './forumdata/watermark_temp.jpg';
             clearstatcache();
             if ($this->attachinfo['mime'] == 'image/jpeg') {
                 $imagefunc($dst_photo, $targetfile, $watermarkquality);
             } else {
                 $imagefunc($dst_photo, $targetfile);
             }
             $this->attach['size'] = filesize($targetfile);
         }
     }
 }
开发者ID:BGCX067,项目名称:f2cont-svn-to-git,代码行数:94,代码来源:image.class.php

示例5: Watermark_GD

 function Watermark_GD()
 {
     if (function_exists('imagecopy') && function_exists('imagealphablending') && function_exists('imagecopymerge')) {
         $imagecreatefromfunc = $this->imagecreatefromfunc;
         $imagefunc = $this->imagefunc;
         list($img_w, $img_h) = $this->attachinfo;
         if ($this->watermarktype < 2) {
             //非文本
             $watermark_file = HDWIKI_ROOT . './style/default/watermark/logo.' . ($this->watermarktype == 1 ? 'png' : 'gif');
             $watermarkinfo = @getimagesize($watermark_file);
             $watermark_logo = $this->watermarktype == 1 ? @imageCreateFromPNG($watermark_file) : @imageCreateFromGIF($watermark_file);
             if (!$watermark_logo) {
                 return;
             }
             list($logo_w, $logo_h) = $watermarkinfo;
         } else {
             //水印是文本类型
             $watermarktextcvt = $this->watermarktext['text'];
             $box = imagettfbbox($this->watermarktext['size'], $this->watermarktext['angle'], $this->watermarktext['fontpath'], $watermarktextcvt);
             $logo_h = max($box[1], $box[3]) - min($box[5], $box[7]);
             $logo_w = max($box[2], $box[4]) - min($box[0], $box[6]);
             $ax = min($box[0], $box[6]) * -1;
             $ay = min($box[5], $box[7]) * -1;
         }
         $wmwidth = $img_w - $logo_w;
         $wmheight = $img_h - $logo_h;
         if (($this->watermarktype < 2 && is_readable($watermark_file) || $this->watermarktype == 2) && $wmwidth > 10 && $wmheight > 10 && !$this->animatedgif) {
             switch ($this->watermarkstatus) {
                 case 1:
                     $x = +5;
                     $y = +5;
                     break;
                 case 2:
                     $x = ($img_w - $logo_w) / 2;
                     $y = +5;
                     break;
                 case 3:
                     $x = $img_w - $logo_w - 5;
                     $y = +5;
                     break;
                 case 4:
                     $x = +5;
                     $y = ($img_h - $logo_h) / 2;
                     break;
                 case 5:
                     $x = ($img_w - $logo_w) / 2;
                     $y = ($img_h - $logo_h) / 2;
                     break;
                 case 6:
                     $x = $img_w - $logo_w - 5;
                     $y = ($img_h - $logo_h) / 2;
                     break;
                 case 7:
                     $x = +5;
                     $y = $img_h - $logo_h - 5;
                     break;
                 case 8:
                     $x = ($img_w - $logo_w) / 2;
                     $y = $img_h - $logo_h - 5;
                     break;
                 case 9:
                     $x = $img_w - $logo_w - 5;
                     $y = $img_h - $logo_h - 5;
                     break;
             }
             $dst_photo = imagecreatetruecolor($img_w, $img_h);
             $target_photo = @$imagecreatefromfunc($this->srcfile);
             imageCopy($dst_photo, $target_photo, 0, 0, 0, 0, $img_w, $img_h);
             if ($this->watermarktype == 1) {
                 imageCopy($dst_photo, $watermark_logo, $x, $y, 0, 0, $logo_w, $logo_h);
             } elseif ($this->watermarktype == 2) {
                 if (($this->watermarktext['shadowx'] || $this->watermarktext['shadowy']) && $this->watermarktext['shadowcolor']) {
                     $shadowcolorrgb = $this->excolor($this->watermarktext['shadowcolor']);
                     $shadowcolor = imagecolorallocate($dst_photo, $shadowcolorrgb[0], $shadowcolorrgb[1], $shadowcolorrgb[2]);
                     imagettftext($dst_photo, $this->watermarktext['size'], $this->watermarktext['angle'], $x + $ax + $this->watermarktext['shadowx'], $y + $ay + $this->watermarktext['shadowy'], $shadowcolor, $this->watermarktext['fontpath'], $watermarktextcvt);
                 }
                 $colorrgb = $this->excolor($this->watermarktext['color']);
                 $color = imagecolorallocate($dst_photo, $colorrgb[0], $colorrgb[1], $colorrgb[2]);
                 imagettftext($dst_photo, $this->watermarktext['size'], $this->watermarktext['angle'], $x + $ax, $y + $ay, $color, $this->watermarktext['fontpath'], $watermarktextcvt);
             } else {
                 imageAlphaBlending($watermark_logo, true);
                 imageCopyMerge($dst_photo, $watermark_logo, $x, $y, 0, 0, $logo_w, $logo_h, $this->watermarktrans);
             }
             if ($this->attachinfo['mime'] == 'image/jpeg') {
                 $imagefunc($dst_photo, $this->targetfile, $this->watermarkquality);
             } else {
                 $imagefunc($dst_photo, $this->targetfile);
             }
         } else {
             return false;
         }
     }
     return true;
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:94,代码来源:watermark.class.php

示例6: waterMark

 /**
  * 给图片增加水印(使用GD库)
  * @return void
  */
 function waterMark($targetFile = '', $upFile = '')
 {
     if ($targetFile) {
         $this->image($targetFile, $upFile);
     }
     if ($this->waterMarkMinWidth && $this->targetInfo[0] <= $this->waterMarkMinWidth && $this->waterMarkMinHeight && $this->targetInfo[1] <= $this->waterMarkMinHeight || $this->waterMarkType == 2 && (!file_exists($this->waterMarkText['fontpath']) || !is_file($this->waterMarkText['fontpath']))) {
         return;
     }
     if ($this->waterMarkStatus && function_exists('imagecopy') && function_exists('imagealphablending') && function_exists('imagecopymerge')) {
         $imageCreateFromFunc = $this->imageCreateFromFunc;
         $imageFunc = $this->imageFunc;
         list($imgWidth, $imgHeight) = $this->targetInfo;
         if ($this->waterMarkType < 2) {
             $waterMarkFile = $this->waterMarkType == 1 ? MOOPHP_ROOT . '/' . $this->waterImagePath . 'watermark.png' : MOOPHP_ROOT . '/' . $this->waterImagePath . 'watermark.gif';
             $waterMarkInfo = @getimagesize($waterMarkFile);
             $waterMarkLogo = $this->waterMarkType == 1 ? @imageCreateFromPNG($waterMarkFile) : @imageCreateFromGIF($waterMarkFile);
             if (!$waterMarkLogo) {
                 return;
             }
             list($logoWidth, $logoHeight) = $waterMarkInfo;
         }
         $wmwidth = $imgWidth - $logoWidth;
         $wmheight = $imgHeight - $logoHeight;
         if (($this->waterMarkType < 2 && is_readable($waterMarkFile) || $this->waterMarkType == 2) && $wmwidth > 10 && $wmheight > 10 && !$this->animatedGif) {
             switch ($this->waterMarkStatus) {
                 case 1:
                     $x = +5;
                     $y = +5;
                     break;
                 case 2:
                     $x = ($imgWidth - $logoWidth) / 2;
                     $y = +5;
                     break;
                 case 3:
                     $x = $imgWidth - $logoWidth - 5;
                     $y = +5;
                     break;
                 case 4:
                     $x = +5;
                     $y = ($imgHeight - $logoHeight) / 2;
                     break;
                 case 5:
                     $x = ($imgWidth - $logoWidth) / 2;
                     $y = ($imgHeight - $logoHeight) / 2;
                     break;
                 case 6:
                     $x = $imgWidth - $logoWidth;
                     $y = ($imgHeight - $logoHeight) / 2;
                     break;
                 case 7:
                     $x = +5;
                     $y = $imgHeight - $logoHeight - 5;
                     break;
                 case 8:
                     $x = ($imgWidth - $logoWidth) / 2;
                     $y = $imgHeight - $logoHeight - 5;
                     break;
                 case 9:
                     $x = $imgWidth - $logoWidth - 5;
                     $y = $imgHeight - $logoHeight - 5;
                     break;
             }
             $destinationPhoto = imagecreatetruecolor($imgWidth, $imgHeight);
             $targetPhoto = @$imageCreateFromFunc($this->targetFile);
             imageCopy($destinationPhoto, $targetPhoto, 0, 0, 0, 0, $imgWidth, $imgHeight);
             if ($this->waterMarkType == 1) {
                 imageCopy($destinationPhoto, $waterMarkLogo, $x, $y, 0, 0, $logoWidth, $logoHeight);
             } else {
                 imageAlphaBlending($waterMarkLogo, true);
                 imageCopyMerge($destinationPhoto, $waterMarkLogo, $x, $y, 0, 0, $logoWidth, $logoHeight, $this->waterMarkTrans);
             }
             clearstatcache();
             if ($this->targetInfo['mime'] == 'image/jpeg') {
                 $imageFunc($destinationPhoto, $this->targetFile, $this->waterMarkQuality);
             } else {
                 $imageFunc($destinationPhoto, $this->targetFile);
             }
             $this->upFile['size'] = filesize($this->targetFile);
         }
     }
 }
开发者ID:noikiy,项目名称:zays,代码行数:85,代码来源:MooImage.class.php

示例7: Watermark_GD


//.........这里部分代码省略.........
         if ($watermarkinfo === FALSE) {
             return -3;
         }
         $watermark_logo = $this->param['watermarktype'][$type] == 'png' ? @imageCreateFromPNG($this->param['watermarkfile'][$type]) : @imageCreateFromGIF($this->param['watermarkfile'][$type]);
         if (!$watermark_logo) {
             return 0;
         }
         list($logo_w, $logo_h) = $watermarkinfo;
     } else {
         if (!function_exists('imagettfbbox') || !function_exists('imagettftext') || !function_exists('imagecolorallocate')) {
             return -4;
         }
         if (!class_exists('Chinese')) {
             include libfile('class/chinese');
         }
         $watermarktextcvt = pack("H*", $this->param['watermarktext']['text'][$type]);
         $box = imagettfbbox($this->param['watermarktext']['size'][$type], $this->param['watermarktext']['angle'][$type], $this->param['watermarktext']['fontpath'][$type], $watermarktextcvt);
         $logo_h = max($box[1], $box[3]) - min($box[5], $box[7]);
         $logo_w = max($box[2], $box[4]) - min($box[0], $box[6]);
         $ax = min($box[0], $box[6]) * -1;
         $ay = min($box[5], $box[7]) * -1;
     }
     $wmwidth = $this->imginfo['width'] - $logo_w;
     $wmheight = $this->imginfo['height'] - $logo_h;
     if ($wmwidth > 10 && $wmheight > 10 && !$this->imginfo['animated']) {
         switch ($this->param['watermarkstatus'][$type]) {
             case 1:
                 $x = 5;
                 $y = 5;
                 break;
             case 2:
                 $x = ($this->imginfo['width'] - $logo_w) / 2;
                 $y = 5;
                 break;
             case 3:
                 $x = $this->imginfo['width'] - $logo_w - 5;
                 $y = 5;
                 break;
             case 4:
                 $x = 5;
                 $y = ($this->imginfo['height'] - $logo_h) / 2;
                 break;
             case 5:
                 $x = ($this->imginfo['width'] - $logo_w) / 2;
                 $y = ($this->imginfo['height'] - $logo_h) / 2;
                 break;
             case 6:
                 $x = $this->imginfo['width'] - $logo_w;
                 $y = ($this->imginfo['height'] - $logo_h) / 2;
                 break;
             case 7:
                 $x = 5;
                 $y = $this->imginfo['height'] - $logo_h - 5;
                 break;
             case 8:
                 $x = ($this->imginfo['width'] - $logo_w) / 2;
                 $y = $this->imginfo['height'] - $logo_h - 5;
                 break;
             case 9:
                 $x = $this->imginfo['width'] - $logo_w - 5;
                 $y = $this->imginfo['height'] - $logo_h - 5;
                 break;
         }
         if ($this->imginfo['mime'] != 'image/png') {
             $color_photo = imagecreatetruecolor($this->imginfo['width'], $this->imginfo['height']);
         }
         $dst_photo = $this->loadsource();
         if ($dst_photo < 0) {
             return $dst_photo;
         }
         imagealphablending($dst_photo, true);
         imagesavealpha($dst_photo, true);
         if ($this->imginfo['mime'] != 'image/png') {
             imageCopy($color_photo, $dst_photo, 0, 0, 0, 0, $this->imginfo['width'], $this->imginfo['height']);
             $dst_photo = $color_photo;
         }
         if ($this->param['watermarktype'][$type] == 'png') {
             imageCopy($dst_photo, $watermark_logo, $x, $y, 0, 0, $logo_w, $logo_h);
         } elseif ($this->param['watermarktype'][$type] == 'text') {
             if (($this->param['watermarktext']['shadowx'][$type] || $this->param['watermarktext']['shadowy'][$type]) && $this->param['watermarktext']['shadowcolor'][$type]) {
                 $shadowcolorrgb = explode(',', $this->param['watermarktext']['shadowcolor'][$type]);
                 $shadowcolor = imagecolorallocate($dst_photo, $shadowcolorrgb[0], $shadowcolorrgb[1], $shadowcolorrgb[2]);
                 imagettftext($dst_photo, $this->param['watermarktext']['size'][$type], $this->param['watermarktext']['angle'][$type], $x + $ax + $this->param['watermarktext']['shadowx'][$type], $y + $ay + $this->param['watermarktext']['shadowy'][$type], $shadowcolor, $this->param['watermarktext']['fontpath'][$type], $watermarktextcvt);
             }
             $colorrgb = explode(',', $this->param['watermarktext']['color'][$type]);
             $color = imagecolorallocate($dst_photo, $colorrgb[0], $colorrgb[1], $colorrgb[2]);
             imagettftext($dst_photo, $this->param['watermarktext']['size'][$type], $this->param['watermarktext']['angle'][$type], $x + $ax, $y + $ay, $color, $this->param['watermarktext']['fontpath'][$type], $watermarktextcvt);
         } else {
             imageAlphaBlending($watermark_logo, true);
             imageCopyMerge($dst_photo, $watermark_logo, $x, $y, 0, 0, $logo_w, $logo_h, $this->param['watermarktrans'][$type]);
         }
         clearstatcache();
         if ($this->imginfo['mime'] == 'image/jpeg') {
             @$imagefunc($dst_photo, $this->target, $this->param['watermarkquality'][$type]);
         } else {
             @$imagefunc($dst_photo, $this->target);
         }
     }
     return 1;
 }
开发者ID:dalinhuang,项目名称:healthshop,代码行数:101,代码来源:class_image.php

示例8: thumb_gd

 private function thumb_gd()
 {
     $this->initi_img();
     if (!is_resource($this->im)) {
         return false;
     }
     $this->dst_img();
     $this->width = imagesx($this->im);
     $this->height = imagesy($this->im);
     /**
      * 改变后的图象的比例
      */
     $resize_ratio = $this->resize_width / $this->resize_height;
     /**
      * 实际图象的比例
      */
     $ratio = $this->width / $this->height;
     if ($this->scale > 0 && $this->filling) {
         $wh = $this->scale;
         //			if ($this->resize_height > $this->resize_width){
         //				$wh = $this->resize_height;
         //			}else{
         //				$wh = $this->resize_width;
         //			}
         if ($ratio > 1) {
             $dst_y = ($wh - $wh / $ratio) / 2;
             $dst_x = 0;
         } else {
             $dst_x = ($wh - $wh * $ratio) / 2;
             $dst_y = 0;
         }
         //等比缩图(宽高最大为$wh)
         if ($resize_ratio > 1) {
             $s_width = $wh;
             $s_height = $wh / $resize_ratio;
         } else {
             $s_height = $wh;
             $s_width = $wh * $resize_ratio;
         }
         $snewimg = imagecreatetruecolor($s_width, $s_height);
         imagecopyresampled($snewimg, $this->im, 0, 0, 0, 0, $s_width, $s_height, $this->width, $this->height);
         //			$snewimg = imagecreatetruecolor($this->resize_width,$this->resize_height);
         //			imagecopyresampled($snewimg, $this->im, 0, 0, 0, 0, $this->resize_width, $this->resize_height, $this->width, $this->height);
         //创建空白正方目标图
         $newimg = imagecreatetruecolor($wh, $wh);
         $white = imagecolorallocate($newimg, 255, 255, 255);
         imagefill($newimg, 0, 0, $white);
         //填入图片
         imageCopyMerge($newimg, $snewimg, $dst_x, $dst_y, 0, 0, $s_width, $s_height, 100);
         //			imageCopyMerge($newimg, $snewimg,$dst_x,$dst_y,0,0,$this->resize_width,$this->resize_height,100);
         //			imageCopyMerge($newimg, $snewimg,$dst_x,$dst_y,0,0,$this->width*$wh/$this->height,$wh,100);
         $foreground_color = imagecolorallocate($newimg, 255, 0, 0);
         ImageJpeg($newimg, $this->dstimg, $this->config['thumb_quality']);
         ImageDestroy($snewimg);
     } else {
         /**
          * 不裁图
          */
         if ($ratio > 1) {
             //宽大高小
             $this->resize_height = $this->resize_width * $this->height / $this->width;
         } else {
             $this->resize_width = $this->resize_height * $this->width / $this->height;
         }
         $newimg = imagecreatetruecolor($this->resize_width, $this->resize_height);
         imagecopyresampled($newimg, $this->im, 0, 0, 0, 0, $this->resize_width, $this->resize_height, $this->width, $this->height);
         ImageJpeg($newimg, $this->dstimg, $this->config['thumb_quality']);
     }
     /**
      * 销毁临时图
      */
     ImageDestroy($this->im);
     ImageDestroy($newimg);
 }
开发者ID:noikiy,项目名称:cunkou,代码行数:74,代码来源:resizeimage.php

示例9: addWaterMarkImage

 /**
  * Add a Water Mark to the image
  * (filigrana)
  *
  * @param string $from
  * @param string $waterMark
  */
 public function addWaterMarkImage($waterMark, $opacity = 35, $x = 5, $y = 5)
 {
     // set data
     $size = $this->info;
     $im = $this->gdID;
     // set WaterMark's data
     $waterMarkSM = new SmartImage($waterMark);
     $imWM = $waterMarkSM->getGDid();
     // Add it!
     // In png watermark images we ignore the opacity (you have to set it in the watermark image)
     if ($waterMarkSM->info[2] == 3) {
         imageCopy($im, $imWM, $x, $y, 0, 0, imagesx($imWM), imagesy($imWM));
     } else {
         imageCopyMerge($im, $imWM, $x, $y, 0, 0, imagesx($imWM), imagesy($imWM), $opacity);
     }
     $waterMarkSM->close();
     $this->gdID = $im;
 }
开发者ID:peppolypus,项目名称:Sistemi-Multimediali,代码行数:25,代码来源:SmartImage.php

示例10: waterMark


//.........这里部分代码省略.........
             $posX = rand(0, $imgWidth - $w);
             $posY = rand(0, $imgHeight - $h);
             break;
         case 1:
             //1为顶端居左
             $posX = 0;
             $posY = 0;
             break;
         case 2:
             //2为顶端居中
             $posX = ($imgWidth - $w) / 2;
             $posY = 0;
             break;
         case 3:
             //3为顶端居右
             $posX = $imgWidth - $w;
             $posY = 0;
             break;
         case 4:
             //4为中部居左
             $posX = 0;
             $posY = ($imgHeight - $h) / 2;
             break;
         case 5:
             //5为中部居中
             $posX = ($imgWidth - $w) / 2;
             $posY = ($imgHeight - $h) / 2;
             break;
         case 6:
             //6为中部居右
             $posX = $imgWidth - $w;
             $posY = ($imgHeight - $h) / 2;
             break;
         case 7:
             //7为底端居左
             $posX = 0;
             $posY = $imgHeight - $h;
             break;
         case 8:
             //8为底端居中
             $posX = ($imgWidth - $w) / 2;
             $posY = $imgHeight - $h;
             break;
         case 9:
             //9为底端居右
             $posX = $imgWidth - $w;
             $posY = $imgHeight - $h;
             break;
         default:
             //随机
             $posX = rand(0, $imgWidth - $w);
             $posY = rand(0, $imgHeight - $h);
             break;
     }
     //设定图像的混色模式
     imagealphablending($sourceImage, true);
     if ($isWaterImage) {
         //图片水印
         imageCopyMerge($sourceImage, $waterImage, $posX, $posY, 0, 0, $waterWidth, $waterHeight, $this->alpha);
     } else {
         //文字水印
         if (!empty($this->fontColor) && strlen($this->fontColor) == 7) {
             $R = hexdec(substr($this->fontColor, 1, 2));
             $G = hexdec(substr($this->fontColor, 3, 2));
             $B = hexdec(substr($this->fontColor, 5));
         } else {
             $R = hexdec('00');
             $G = hexdec('00');
             $B = hexdec('00');
         }
         if (file_exists($this->fontFile)) {
             imagettftext($sourceImage, $this->fontSize, 0, $posX, $h + $posY, imagecolorallocate($sourceImage, $R, $G, $B), $this->fontFile, $this->waterText);
         } else {
             imagestring($sourceImage, $this->fontSize, $posX, $posY - $h, $this->waterText, imagecolorallocate($sourceImage, $R, $G, $B));
         }
     }
     //生成水印后的图片
     //@unlink($sourcefile);
     switch ($imgtype) {
         //取得背景图片的格式
         case 1:
             imagegif($sourceImage, $sourcefile);
             break;
         case 2:
             imagejpeg($sourceImage, $sourcefile);
             break;
         case 3:
             imagepng($sourceImage, $sourcefile);
             break;
         default:
             die($errorMsg);
     }
     //释放内存
     if (isset($waterImage)) {
         imagedestroy($waterImage);
     }
     if (isset($sourceImage)) {
         imagedestroy($sourceImage);
     }
 }
开发者ID:sammychan1981,项目名称:quanpin,代码行数:101,代码来源:image_class.php

示例11: create

 function create($filename = "")
 {
     if ($filename) {
         $this->src_image_name = strtolower(trim($filename));
     }
     if (!file_exists($this->src_image_name)) {
         return false;
     }
     if ($this->wm_image_pos == 99) {
         return $this->save_image_file;
     }
     $src_image_type = $this->get_type($this->src_image_name);
     $src_image = $this->createImage($src_image_type, $this->src_image_name);
     if (!$src_image) {
         return;
     }
     $src_image_w = ImageSX($src_image);
     $src_image_h = ImageSY($src_image);
     if ($this->wm_image_name && file_exists($this->wm_image_name)) {
         $this->wm_image_name = strtolower(trim($this->wm_image_name));
         $wm_image_type = $this->get_type($this->wm_image_name);
         $wm_image = $this->createImage($wm_image_type, $this->wm_image_name);
         if (!@($wm_image_w = ImageSX($wm_image))) {
             return false;
         }
         if (!@($wm_image_h = ImageSY($wm_image))) {
             return false;
         }
         if ($this->wm_image_dest_x && $this->wm_image_dest_y) {
             $wm_image_x = $this->wm_image_dest_x;
             $wm_image_y = $this->wm_image_dest_y;
         } else {
             $temp_wm_image = $this->getPos($src_image_w, $src_image_h, $this->wm_image_pos, $wm_image);
             $wm_image_x = $temp_wm_image["dest_x"];
             $wm_image_y = $temp_wm_image["dest_y"];
         }
         imageCopyMerge($src_image, $wm_image, $wm_image_x, $wm_image_y, 0, 0, $wm_image_w, $wm_image_h, $this->wm_image_transition);
     }
     if ($this->wm_text) {
         $this->wm_text = $this->gb2utf8($this->wm_text);
         if ($this->wm_text_dest_x && $this->wm_text_dest_y) {
             //绝对定位
             $temp_wm_text = $this->getPos($src_image_w, $src_image_h, $this->wm_text_pos);
             $wm_text_x = $temp_wm_text["dest_x"];
             //$this->wm_text_dest_x;
             $wm_text_y = $this->wm_text_dest_y;
         } else {
             $temp_wm_text = $this->getPos($src_image_w, $src_image_h, $this->wm_text_pos);
             $wm_text_x = $temp_wm_text["dest_x"];
             $wm_text_y = $temp_wm_text["dest_y"];
         }
         if (preg_match("/([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])/i", $this->wm_text_color, $color)) {
             $red = hexdec($color[1]);
             $green = hexdec($color[2]);
             $blue = hexdec($color[3]);
             $wm_text_color = imagecolorallocate($src_image, $red, $green, $blue);
         } else {
             $wm_text_color = imagecolorallocate($src_image, 255, 255, 255);
         }
         imagettftext($src_image, $this->wm_text_size, $this->wm_text_angle, $wm_text_x, $wm_text_y, $wm_text_color, $this->wm_text_font, $this->wm_text);
     }
     if ($this->save_image_file) {
         switch ($this->output_type) {
             case 'gif':
                 $src_img = ImagePNG($src_image, $this->save_image_file);
                 break;
             case 'jpeg':
                 $src_img = ImageJPEG($src_image, $this->save_image_file, $this->jpeg_quality);
                 break;
             case 'png':
                 $src_img = ImagePNG($src_image, $this->save_image_file);
                 break;
             default:
                 $src_img = ImageJPEG($src_image, $this->save_image_file, $this->jpeg_quality);
                 break;
         }
     } else {
         if ($src_image_type = "jpg") {
             $src_image_type = "jpeg";
         }
         header("Content-type: image/{$src_image_type}");
         switch ($src_image_type) {
             case 'gif':
                 $src_img = imagegif($src_image);
                 break;
             case 'jpg':
                 $src_img = ImageJPEG($src_image, "", $this->jpeg_quality);
                 break;
             case 'png':
                 $src_img = ImagePNG($src_image);
                 break;
             default:
                 $src_img = ImageJPEG($src_image, "", $this->jpeg_quality);
                 break;
         }
     }
     imagedestroy($src_image);
     return $this->save_image_file;
 }
开发者ID:dalinhuang,项目名称:zhixin-xianzi,代码行数:99,代码来源:class.image.php

示例12: mergePix

 function mergePix($bgPath, $srcPath, $destPath, $pos = 0, $transition = 100)
 {
     //Get the resource id´s of the pictures
     $srcPath_id = imageCreateFromJPEG($srcPath);
     $bgPath_id = imageCreateFromJPEG($bgPath);
     //Get the sizes of both pix
     $bgPath_width = imageSX($bgPath_id);
     $bgPath_height = imageSY($bgPath_id);
     $srcPath_width = imageSX($srcPath_id);
     $srcPath_height = imageSY($srcPath_id);
     //middle
     if ($pos == 0) {
         $dest_x = $bgPath_width / 2 - $srcPath_width / 2;
         $dest_y = $bgPath_height / 2 - $srcPath_height / 2;
     }
     //top left
     if ($pos == 1) {
         $dest_x = 0;
         $dest_y = 0;
     }
     //top right
     if ($pos == 2) {
         $dest_x = $bgPath_width - $srcPath_width;
         $dest_y = 0;
     }
     //bottom right
     if ($pos == 3) {
         $dest_x = $bgPath_width - $srcPath_width;
         $dest_y = $bgPath_height - $srcPath_height;
     }
     //bottom left
     if ($pos == 4) {
         $dest_x = 0;
         $dest_y = $bgPath_height - $srcPath_height;
     }
     //top middle
     if ($pos == 5) {
         $dest_x = ($bgPath_width - $srcPath_width) / 2;
         $dest_y = 0;
     }
     //middle right
     if ($pos == 6) {
         $dest_x = $bgPath_width - $srcPath_width;
         $dest_y = $bgPath_height / 2 - $srcPath_height / 2;
     }
     //bottom middle
     if ($pos == 7) {
         $dest_x = ($bgPath_width - $srcPath_width) / 2;
         $dest_y = $bgPath_height - $srcPath_height;
     }
     //middle left
     if ($pos == 8) {
         $dest_x = 0;
         $dest_y = $bgPath_height / 2 - $srcPath_height / 2;
     }
     //The main thing : merge the two pix
     imageCopyMerge($bgPath_id, $srcPath_id, $dest_x, $dest_y, 0, 0, $srcPath_width, $srcPath_height, $transition);
     //Create a jpeg out of the modified picture
     imagejpeg($bgPath_id, "{$destPath}", 100);
 }
开发者ID:akswosn,项目名称:tossi,代码行数:60,代码来源:ImageProcess.php

示例13: file_exists

<?php

/* $Id$ */
if (!defined('IMG_GIF')) {
    $rank = file_exists("rank" . $_GET['rank'] . ".gif") ? $_GET['rank'] : "bg";
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: rank{$rank}.gif");
    exit;
} else {
    header('Content-type: image/gif');
    $bg = @imageCreateFromGIF("rankbg.gif");
    $fg = @imageCreateFromGIF("rank{$_GET['rank']}.gif");
    if (!$bg && !$fg) {
        exit;
    }
    // Null image, but who cares?  Wrong is wrong is wrong.
    if (!$bg) {
        imageGIF($fg);
        exit;
    }
    if ($fg) {
        imageCopyMerge($bg, $fg, 0, 0, 0, 0, 17, 17, 100);
    }
    imageGIF($bg);
}
开发者ID:benblank,项目名称:grimtimes,代码行数:25,代码来源:rankgif.php

示例14: create

 /**
  * 生成增加水印的图片
  *
  * <code>
  * //使用示例
  * <?php
  * 		$img = new GDImage();
  * 		//文字水印
  * 		$img->wm_text = "www.shopnc.net";
  * 		$img->wm_text_font = "./STXINWEI.TTF";
  * 		//图片水印
  * 		$img->wm_image_name="水印图片名";
  * 		$img->create("生成图片文件名(包括路径)");
  * ?>
  * </code>
  *
  * @param string $filename 需要增加水印的图片文件名
  * @return bool 布尔类型的返回结果
  */
 public function create($filename = "")
 {
     @ini_set('memory_limit', '-1');
     if ($filename) {
         $this->src_image_name = strtolower(trim($filename));
         $this->save_file = $this->src_image_name;
     }
     $src_image_type = $this->get_type($this->src_image_name);
     $src_image = $this->createImage($src_image_type, $this->src_image_name);
     if (!$src_image) {
         return false;
     }
     $src_image_w = ImageSX($src_image);
     $src_image_h = ImageSY($src_image);
     if ($this->wm_image_name) {
         $this->wm_image_name = strtolower(trim($this->wm_image_name));
         $wm_image_type = $this->get_type($this->wm_image_name);
         $wm_image = $this->createImage($wm_image_type, $this->wm_image_name);
         $wm_image_w = ImageSX($wm_image);
         $wm_image_h = ImageSY($wm_image);
         $temp_wm_image = $this->getPos($src_image_w, $src_image_h, $this->wm_image_pos, $wm_image);
         $wm_image_x = $temp_wm_image["dest_x"];
         $wm_image_y = $temp_wm_image["dest_y"];
         imageCopyMerge($src_image, $wm_image, $wm_image_x, $wm_image_y, 0, 0, $wm_image_w, $wm_image_h, $this->wm_image_transition);
     }
     if ($this->wm_text) {
         $temp_wm_text = $this->getPos($src_image_w, $src_image_h, $this->wm_text_pos);
         $wm_text_x = $temp_wm_text["dest_x"];
         $wm_text_y = $temp_wm_text["dest_y"];
         if (preg_match("/([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])/i", $this->wm_text_color, $color)) {
             $red = hexdec($color[1]);
             $green = hexdec($color[2]);
             $blue = hexdec($color[3]);
             $wm_text_color = imagecolorallocate($src_image, $red, $green, $blue);
         } else {
             $wm_text_color = imagecolorallocate($src_image, 255, 255, 255);
         }
         imagettftext($src_image, $this->wm_text_size, $this->wm_angle, $wm_text_x, $wm_text_y, $wm_text_color, $this->wm_text_font, $this->wm_text);
     }
     if ($this->save_file) {
         switch ($this->get_type($this->save_file)) {
             case 'gif':
                 $src_img = imagegif($src_image, $this->save_file);
                 break;
             case 'jpeg':
                 $src_img = ImageJPEG($src_image, $this->save_file, $this->jpeg_quality);
                 break;
             case 'jpg':
                 $src_img = ImageJPEG($src_image, $this->save_file, $this->jpeg_quality);
                 break;
             case 'png':
                 $src_img = ImagePNG($src_image, $this->save_file);
                 break;
             default:
                 $src_img = ImageJPEG($src_image, $this->save_file, $this->jpeg_quality);
                 break;
         }
     } else {
         if ($src_image_type == "jpg") {
             $src_image_type = "jpeg";
         }
         @header("Content-type: image/{$src_image_type}");
         switch ($src_image_type) {
             case 'gif':
                 $src_img = imagegif($src_image);
                 break;
             case 'jpg':
                 $src_img = ImageJPEG($src_image, "", $this->jpeg_quality);
                 break;
             case 'jpeg':
                 $src_img = ImageJPEG($src_image, "", $this->jpeg_quality);
                 break;
             case 'png':
                 $src_img = ImagePNG($src_image);
                 break;
             default:
                 $src_img = ImageJPEG($src_image, "", $this->jpeg_quality);
                 break;
         }
     }
     imagedestroy($src_image);
//.........这里部分代码省略.........
开发者ID:Maplecms,项目名称:shopnc-yhmall,代码行数:101,代码来源:gdimage.php

示例15: watermark


//.........这里部分代码省略.........
         if (!($watermark_logo = @imageCreateFromPNG($watermarkfile))) {
             return 0;
         }
         list($logo_w, $logo_h) = $watermarkinfo;
     } else {
         if ($this->params['watermarktype'] == 'text') {
             if (!function_exists('imagettfbbox') || !function_exists('imagettftext') || !function_exists('imagecolorallocate')) {
                 return -4;
             }
             $font_file = __CFG::DIR . 'data/watermark/' . $this->params['watermarktext']['font'];
             $font_size = $this->params['watermarktext']['size'] ? $this->params['watermarktext']['size'] : '14';
             if (!file_exists($font_file)) {
                 return -5;
             }
             $font_text = str_replace(array("\n", "\r", "'"), array('', '', '\''), $this->params['watermarktext']['text']);
             $font_text = str_replace('{name}', $name, $font_text);
             //$font_text = pack("H*", $text);
             $box = imagettfbbox($font_size, 0, $font_file, $font_text);
             $logo_h = max($box[1], $box[3]) - min($box[5], $box[7]);
             $logo_w = max($box[2], $box[4]) - min($box[0], $box[6]);
             $ax = min($box[0], $box[6]) * -1;
             $ay = min($box[5], $box[7]) * -1;
         } else {
             return -6;
         }
     }
     $wmwidth = $info['width'] - $logo_w;
     $wmheight = $info['height'] - $logo_h;
     if ($wmwidth > 10 && $wmheight > 10) {
         switch ($this->params['watermarkstatus']) {
             case 1:
                 $x = 5;
                 $y = 5;
                 break;
             case 2:
                 $x = ($info['width'] - $logo_w) / 2;
                 $y = 5;
                 break;
             case 3:
                 $x = $info['width'] - $logo_w - 5;
                 $y = 5;
                 break;
             case 4:
                 $x = 5;
                 $y = ($info['height'] - $logo_h) / 2;
                 break;
             case 5:
                 $x = ($info['width'] - $logo_w) / 2;
                 $y = ($info['height'] - $logo_h) / 2;
                 break;
             case 6:
                 $x = $info['width'] - $logo_w;
                 $y = ($info['height'] - $logo_h) / 2;
                 break;
             case 7:
                 $x = 5;
                 $y = $info['height'] - $logo_h - 5;
                 break;
             case 8:
                 $x = ($info['width'] - $logo_w) / 2;
                 $y = $info['height'] - $logo_h - 5;
                 break;
             case 9:
             default:
                 $x = $info['width'] - $logo_w - 5;
                 $y = $info['height'] - $logo_h - 5;
                 break;
         }
         if (!($dst_photo = $this->loadsource($source, $info['mime']))) {
             return false;
         }
         imagealphablending($dst_photo, true);
         imagesavealpha($dst_photo, true);
         if ($info['mime'] != 'image/png') {
             $color_photo = imagecreatetruecolor($info['width'], $info['height']);
             imageCopy($color_photo, $dst_photo, 0, 0, 0, 0, $info['width'], $info['height']);
             $dst_photo = $color_photo;
         }
         if ($this->params['watermarktype'] == 'png') {
             imageCopy($dst_photo, $watermark_logo, $x, $y, 0, 0, $logo_w, $logo_h);
         } else {
             if ($this->params['watermarktype'] == 'text') {
                 $colorrgb = sscanf($this->params['watermarktext']['color'], '#%2x%2x%2x');
                 $color = imagecolorallocate($dst_photo, $colorrgb[0], $colorrgb[1], $colorrgb[2]);
                 @imagettftext($dst_photo, $font_size, 0, $x + $ax, $y + $ay, $color, $font_file, $font_text);
             } else {
                 imageAlphaBlending($watermark_logo, true);
                 imageCopyMerge($dst_photo, $watermark_logo, $x, $y, 0, 0, $logo_w, $logo_h, $this->params['watermarktrans']);
             }
         }
         clearstatcache();
         if ($info['mime'] == 'image/jpeg') {
             $watermarkquality = $this->params['watermarkquality'] ? (int) $this->params['watermarkquality'] : 90;
             @Imagejpeg($dst_photo, $source, $watermarkquality);
         } else {
             @$this->save($dst_photo, $source, $info['mime']);
         }
     }
     return 1;
 }
开发者ID:a195474368,项目名称:ejiawang,代码行数:101,代码来源:gd.mdl.php


注:本文中的imageCopyMerge函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。