• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP imageAlphaBlending函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: execute

 /**
  * Method to apply a background color to an image resource.
  *
  * @param   array  $options  An array of options for the filter.
  *                           color  Background matte color
  *
  * @return  void
  *
  * @since   3.4
  * @throws  InvalidArgumentException
  * @deprecated  5.0  Use Joomla\Image\Filter\Backgroundfill::execute() instead
  */
 public function execute(array $options = array())
 {
     // Validate that the color value exists and is an integer.
     if (!isset($options['color'])) {
         throw new InvalidArgumentException('No color value was given. Expected string or array.');
     }
     $colorCode = !empty($options['color']) ? $options['color'] : null;
     // Get resource dimensions
     $width = imagesX($this->handle);
     $height = imagesY($this->handle);
     // Sanitize color
     $rgba = $this->sanitizeColor($colorCode);
     // Enforce alpha on source image
     if (imageIsTrueColor($this->handle)) {
         imageAlphaBlending($this->handle, false);
         imageSaveAlpha($this->handle, true);
     }
     // Create background
     $bg = imageCreateTruecolor($width, $height);
     imageSaveAlpha($bg, empty($rgba['alpha']));
     // Allocate background color.
     $color = imageColorAllocateAlpha($bg, $rgba['red'], $rgba['green'], $rgba['blue'], $rgba['alpha']);
     // Fill background
     imageFill($bg, 0, 0, $color);
     // Apply image over background
     imageCopy($bg, $this->handle, 0, 0, 0, 0, $width, $height);
     // Move flattened result onto curent handle.
     // If handle was palette-based, it'll stay like that.
     imageCopy($this->handle, $bg, 0, 0, 0, 0, $width, $height);
     // Free up memory
     imageDestroy($bg);
     return;
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:45,代码来源:backgroundfill.php


示例2: addWatermark

 /**
  * function addWatermark
  *
  * @param string $imageFile
  * @param string $destinationFile
  */
 function addWatermark($imageFile, $destinationFile = true)
 {
     if ($destinationFile) {
         $destinationFile = $imageFile;
     }
     $watermark = @imagecreatefrompng($this->watermarkFile) or exit('Cannot open the watermark file.');
     imageAlphaBlending($watermark, false);
     imageSaveAlpha($watermark, true);
     $image_string = @file_get_contents($imageFile) or exit('Cannot open image file.');
     $image = @imagecreatefromstring($image_string) or exit('Not a valid image format.');
     $imageWidth = imageSX($image);
     $imageHeight = imageSY($image);
     $watermarkWidth = imageSX($watermark);
     $watermarkHeight = imageSY($watermark);
     if ($this->position == 'center') {
         $coordinate_X = ($imageWidth - $watermarkWidth) / 2;
         $coordinate_Y = ($imageHeight - $watermarkHeight) / 2;
     } else {
         $coordinate_X = $imageWidth - 5 - $watermarkWidth;
         $coordinate_Y = $imageHeight - 5 - $watermarkHeight;
     }
     imagecopy($image, $watermark, $coordinate_X, $coordinate_Y, 0, 0, $watermarkWidth, $watermarkHeight);
     if ($this->imageType == 'jpg') {
         imagejpeg($image, $destinationFile, 100);
     } elseif ($this->imageType == 'gif') {
         imagegif($image, $destinationFile);
     } elseif ($this->imageType == 'png') {
         imagepng($image, $destinationFile, 100);
     }
     imagedestroy($image);
     imagedestroy($watermark);
 }
开发者ID:yunsite,项目名称:demila,代码行数:38,代码来源:watermark.class.php


示例3: __construct

 public function __construct($data)
 {
     $this->data = $data;
     $size = array_key_exists('global', $this->data) ? 'l' : 's';
     $text = !array_key_exists('text', $this->data) || strlen($this->data['text']) > 2 ? '??' : $this->data['text'];
     $font = filter_input(INPUT_SERVER, 'DOCUMENT_ROOT') . '/img/base/xkcd.ttf';
     $fg = $this->hex2rgb($this->colorGiven('fg') ? $this->data['fg'] : '000');
     $bg = $this->hex2rgb($this->colorGiven('bg') ? $this->data['bg'] : '0ff');
     $this->image = imagecreatefrompng($_SERVER['DOCUMENT_ROOT'] . '/img/base/fill_' . $size . '.png');
     imageAlphaBlending($this->image, true);
     imageSaveAlpha($this->image, true);
     $fc = imagecolorallocate($this->image, $fg['r'], $fg['g'], $fg['b']);
     $c = imagecolorallocate($this->image, $bg['r'], $bg['g'], $bg['b']);
     imagefill($this->image, imagesx($this->image) / 2, imagesy($this->image) / 2, $c);
     $outline = imagecreatefrompng($_SERVER['DOCUMENT_ROOT'] . '/img/base/outline_' . $size . '.png');
     imageAlphaBlending($outline, true);
     imageSaveAlpha($outline, true);
     imagecopy($this->image, $outline, 0, 0, 0, 0, imagesx($outline), imagesy($this->image));
     if ($size === 'l') {
         imagettftext($this->image, 12, 0, 3, 25, $fc, $_SERVER['DOCUMENT_ROOT'] . '/img/base/xkcd.ttf', 'global');
         $bounds = imagettfbbox(20, 0, $_SERVER['DOCUMENT_ROOT'] . '/img/base/xkcd.ttf', $text);
         imagettftext($this->image, 20, 0, (imagesx($this->image) - $bounds[4] - $bounds[0]) / 2, 50, $fc, $_SERVER['DOCUMENT_ROOT'] . '/img/base/xkcd.ttf', $text);
     } else {
         $bounds = imagettfbbox(15, 0, $_SERVER['DOCUMENT_ROOT'] . '/img/base/xkcd.ttf', $text);
         imagettftext($this->image, 15, 0, (imagesx($this->image) - $bounds[4] - $bounds[0]) / 2, 22, $fc, $_SERVER['DOCUMENT_ROOT'] . '/img/base/xkcd.ttf', $text);
     }
 }
开发者ID:Eupeodes,项目名称:gh,代码行数:27,代码来源:Marker.php


示例4: hacknrollify

function hacknrollify($picfilename)
{
    $logofilename = "logo.png";
    $logoPicPath = "logopics/" . $logofilename;
    $originalPicPath = "originalpics/" . $picfilename;
    $editedfilename = "hnr_" . $picfilename;
    $editedPicPath = "editedpics/" . $editedfilename;
    // read the original image from file
    $profilepic = imagecreatefromjpeg($originalPicPath);
    $profilepicWidth = imagesx($profilepic);
    $profilepicHeight = imagesy($profilepic);
    // create the black image overlay
    $blackoverlay = imagecreate($profilepicWidth, $profilepicHeight);
    imagecolorallocate($blackoverlay, 0, 0, 0);
    // then merge the black and profilepic
    imagecopymerge($profilepic, $blackoverlay, 0, 0, 0, 0, $profilepicWidth, $profilepicHeight, 50);
    imagedestroy($blackoverlay);
    // merge the resized logo
    $logo = resizeImage($logoPicPath, $profilepicWidth - 80, 999999);
    imageAlphaBlending($logo, false);
    imageSaveAlpha($logo, true);
    $logoWidth = imagesx($logo);
    $logoHeight = imagesy($logo);
    $verticalOffset = $profilepicHeight / 2 - $logoHeight / 2;
    $horizontalOffset = 40;
    imagecopyresampled($profilepic, $logo, $horizontalOffset, $verticalOffset, 0, 0, $logoWidth, $logoHeight, $logoWidth, $logoHeight);
    $mergeSuccess = imagejpeg($profilepic, $editedPicPath);
    if (!$mergeSuccess) {
        echo "Image merge failed!";
    }
    imagedestroy($profilepic);
    imagedestroy($logo);
    return $editedPicPath;
}
开发者ID:nicholaslum444,项目名称:HacknRollify,代码行数:34,代码来源:lib_hacknrollify.php


示例5: createImageImage

 /**
  * Create image resource from image file and alocate required memory
  * @param $imageFile
  * @return resource
  * @throws \Ip\Exception\Repository\Transform
  */
 protected function createImageImage($imageFile)
 {
     $this->getMemoryNeeded($imageFile);
     $mime = $this->getMimeType($imageFile);
     switch ($mime) {
         case IMAGETYPE_JPEG:
         case IMAGETYPE_JPEG2000:
             $originalSetting = ini_set('gd.jpeg_ignore_warning', 1);
             $image = imagecreatefromjpeg($imageFile);
             if ($originalSetting !== false) {
                 ini_set('gd.jpeg_ignore_warning', $originalSetting);
             }
             break;
         case IMAGETYPE_GIF:
             $image = imagecreatefromgif($imageFile);
             imageAlphaBlending($image, false);
             imageSaveAlpha($image, true);
             break;
         case IMAGETYPE_PNG:
             $image = imagecreatefrompng($imageFile);
             imageAlphaBlending($image, false);
             imageSaveAlpha($image, true);
             break;
         default:
             throw new \Ip\Exception\Repository\Transform("Incompatible type. Type detected: " . esc($mime), array('mime' => $mime));
     }
     return $image;
 }
开发者ID:Umz,项目名称:ImpressPages,代码行数:34,代码来源:Image.php


示例6: imgresize

 static function imgresize($photo_src, $width, $name)
 {
     $parametr = getimagesize($photo_src);
     list($width_orig, $height_orig) = getimagesize($photo_src);
     $ratio_orig = $width_orig / $height_orig;
     $new_width = $width;
     $new_height = $width / $ratio_orig;
     $newpic = imagecreatetruecolor($new_width, $new_height);
     imageAlphaBlending($newpic, false);
     imageSaveAlpha($newpic, true);
     switch ($parametr[2]) {
         case 1:
             $image = imagecreatefromgif($photo_src);
             break;
         case 2:
             $image = imagecreatefromjpeg($photo_src);
             break;
         case 3:
             $image = imagecreatefrompng($photo_src);
             break;
     }
     imagecopyresampled($newpic, $image, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig);
     imagepng($newpic, $name);
     return true;
 }
开发者ID:awful0,项目名称:Webmasters-Forge-Ltd,代码行数:25,代码来源:Funct.php


示例7: imageResize

 /**
  * Метод для изменения размера изображения.
  * @link URL Оригинал(Пример1) http://www.php.su/articles/?cat=graph&page=014
  */
 public function imageResize()
 {
     foreach ($this->data as $i => $param) {
         $descriptor = $param['descriptor'];
         $tmpImg = imagecreatetruecolor(20, 20);
         imageAlphaBlending($tmpImg, false);
         imageSaveAlpha($tmpImg, true);
         imagecopyresampled($tmpImg, $descriptor, 0, 0, 0, 0, 20, 20, $param['width'], $param['height']);
         switch ($param['type']) {
             case 'jpg':
                 $this->data[$i]['width'] = 20;
                 $this->data[$i]['height'] = 20;
                 imagejpeg($tmpImg, $param['source']);
                 imagedestroy($tmpImg);
                 break;
             case 'jpeg':
                 $this->data[$i]['width'] = 20;
                 $this->data[$i]['height'] = 20;
                 imagejpeg($tmpImg, $param['source']);
                 imagedestroy($tmpImg);
                 break;
             case 'png':
                 $this->data[$i]['width'] = 20;
                 $this->data[$i]['height'] = 20;
                 imagepng($tmpImg, $param['source']);
                 imagedestroy($tmpImg);
                 break;
         }
     }
 }
开发者ID:hungry-devel,项目名称:pixelArt,代码行数:34,代码来源:Image.class.php


示例8: resize

 public function resize($maxW = null, $maxH = null, $canEnlarge = false)
 {
     $src = $this->_rawImage;
     if ($maxW === null && $maxH === null) {
         return $src;
     }
     if (imageistruecolor($src)) {
         imageAlphaBlending($src, true);
         imageSaveAlpha($src, true);
     }
     $srcW = imagesx($src);
     $srcH = imagesy($src);
     $width = $maxW && ($canEnlarge || $maxW <= $srcW) ? $maxW : $srcW;
     $height = $maxH && ($canEnlarge || $maxH <= $srcW) ? $maxH : $srcH;
     $ratio_orig = $srcW / $srcH;
     if ($width / $height > $ratio_orig) {
         $width = $height * $ratio_orig;
     } else {
         $height = $width / $ratio_orig;
     }
     $maxW = $maxW ? $maxW : $width;
     $maxH = $maxH ? $maxH : $height;
     $img = imagecreatetruecolor($maxW, $maxH);
     $trans_colour = imagecolorallocatealpha($img, 0, 0, 0, 127);
     imagefill($img, 0, 0, $trans_colour);
     $offsetX = ($maxW - $width) / 2;
     $offsetY = ($maxH - $height) / 2;
     imagecopyresampled($img, $src, $offsetX, $offsetY, 0, 0, $width, $height, $srcW, $srcH);
     imagealphablending($img, true);
     imagesavealpha($img, true);
     return $img;
 }
开发者ID:tomk,项目名称:imagehelper,代码行数:32,代码来源:ImageHelper.php


示例9: loadImg

 public function loadImg($file)
 {
     if (!file_exists($file)) {
         //echo("File not found in loadImg().");
         return false;
     }
     $this->imageSize = getimagesize($file);
     if (!defined("IMAGETYPE_JPG")) {
         define("IMAGETYPE_JPG", IMAGETYPE_JPEG);
     }
     switch ($this->imageSize[2]) {
         case IMAGETYPE_JPG:
             $this->img = imagecreatefromjpeg($file);
             $this->file = $file;
             return true;
         case IMAGETYPE_PNG:
             $this->img = imagecreatefrompng($file);
             imageAlphaBlending($this->img, false);
             imageSaveAlpha($this->img, true);
             $this->file = $file;
             return true;
         case IMAGETYPE_GIF:
             $this->img = imagecreatefromgif($file);
             $this->file = $file;
             break;
         case IMAGETYPE_BMP:
             $this->img = ImageCreateFromBMP($file);
             $this->file = $file;
         default:
             //coreIMG::trace("Unknown file format in loadImg().");
             return false;
     }
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:33,代码来源:class.imageResize.php


示例10: resizeImage

 public function resizeImage($newWidth, $originalFile)
 {
     $allowGif = Configure::read('allowGif');
     if (!$allowGif) {
         $info = getimagesize($originalFile);
         $mime = $info['mime'];
         switch ($mime) {
             case 'image/jpeg':
                 $image_create_func = 'imagecreatefromjpeg';
                 $image_save_func = 'imagejpeg';
                 $new_image_ext = 'jpg';
                 break;
             case 'image/png':
                 $image_create_func = 'imagecreatefrompng';
                 $image_save_func = 'imagepng';
                 $new_image_ext = 'png';
                 break;
             case 'image/gif':
                 if (!$allowGif) {
                     $image_create_func = 'imagecreatefromgif';
                     $image_save_func = 'imagegif';
                     $new_image_ext = 'gif';
                 }
                 break;
             default:
                 //throw Exception('Unknown image type.');
         }
         if (isset($image_save_func) && function_exists('imap_open')) {
             $img = $image_create_func($originalFile);
             list($width, $height) = getimagesize($originalFile);
             $newHeight = $height / $width * $newWidth;
             $tmp = imagecreatetruecolor($newWidth, $newHeight);
             $targetFile = $originalFile;
             imageAlphaBlending($tmp, false);
             imageSaveAlpha($tmp, true);
             imagecopyresampled($tmp, $img, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
             if (file_exists($targetFile)) {
                 unlink($targetFile);
             }
             ob_start();
             //Start output buffer.
             $image_save_func($tmp);
             //This will normally output the image, but because of ob_start(), it won't.
             $contents = ob_get_contents();
             //Instead, output above is saved to $contents
             ob_end_clean();
             //End the output buffer.
         } else {
             $contents = null;
         }
     }
     //$image_save_func($tmp, "$targetFile.$new_image_ext");
     return $contents;
 }
开发者ID:sing-group,项目名称:Markyt,代码行数:54,代码来源:User.php


示例11: writeWatermarkInfo

 public function writeWatermarkInfo(&$sourcefileId, $thumbnailMode, CacheFile $cacheFile)
 {
     if (!$this->config->isUsedWatermark() || $thumbnailMode) {
         return;
     }
     static $disable_alpha_warning;
     $watermarkfile = $this->config->getWatermarkFile();
     $align = $this->config->getWatermarkLeft();
     $valign = $this->config->getWatermarkTop();
     if ($this->config->getWatermarkTransparencyType() == 'alpha') {
         $transcolor = FALSE;
     } else {
         $transcolor = $this->config->getWatermarkTransparentColor();
     }
     $transparency = $this->config->getWatermarkTransparency();
     try {
         $watermarkfile_id = $this->loadWatermarkFile($watermarkfile);
     } catch (Exception $e) {
         return false;
     }
     @imageAlphaBlending($watermarkfile_id, false);
     $result = @imageSaveAlpha($watermarkfile_id, true);
     if (!$result) {
         if (!$disable_alpha_warning) {
             $msg = "Watermark problem: your server does not support alpha blending (requires GD 2.0.1+)";
             JLog::add($msg, JLog::WARNING);
         }
         $disable_alpha_warning = true;
         imagedestroy($watermarkfile_id);
         return false;
     }
     $offset_w = $cacheFile->offsetX();
     $offset_h = $cacheFile->offsetY();
     $w = $cacheFile->displayWidth();
     $h = $cacheFile->displayHeight();
     $watermarkfileWidth = imageSX($watermarkfile_id);
     $watermarkfileHeight = imageSY($watermarkfile_id);
     $watermarkOffsetX = $this->calcXOffsetForWatermark($align, $watermarkfileWidth, $offset_w, $w);
     $watermarkOffsetY = $this->calcYOffsetForWatermark($valign, $watermarkfileHeight, $offset_h, $h);
     $fileType = strtolower(pathinfo($watermarkfile, PATHINFO_EXTENSION));
     $sourcefileId = $this->upsampleImageIfNecessary($fileType, $sourcefileId);
     if ($transcolor !== false) {
         $transcolAsInt = intval(str_replace('#', '', $transcolor), 16);
         imagecolortransparent($watermarkfile_id, $transcolAsInt);
         // use transparent color
         imagecopymerge($sourcefileId, $watermarkfile_id, $watermarkOffsetX, $watermarkOffsetY, 0, 0, $watermarkfileWidth, $watermarkfileHeight, $transparency);
     } else {
         imagecopy($sourcefileId, $watermarkfile_id, $watermarkOffsetX, $watermarkOffsetY, 0, 0, $watermarkfileWidth, $watermarkfileHeight);
         // True
         // alphablend
     }
     imagedestroy($watermarkfile_id);
     return true;
 }
开发者ID:harryklein,项目名称:pkg_mosimage,代码行数:54,代码来源:WatermarkCreator.php


示例12: get_file

 private function get_file($type)
 {
     include_once 'Cache_Lite/Lite.php';
     $db = Input::getPath()->part(5);
     $baseLayer = Input::get("baselayer");
     $layers = Input::get("layers");
     $center = Input::get("center");
     $zoom = Input::get("zoom");
     $size = Input::get("size");
     $sizeArr = explode("x", Input::get("size"));
     $bbox = Input::get("bbox");
     $sql = Input::get("sql");
     $id = $db . "_" . $baseLayer . "_" . $layers . "_" . $center . "_" . $zoom . "_" . $size . "_" . $bbox . "_" . $sql;
     $lifetime = Input::get('lifetime') ?: 0;
     $options = array('cacheDir' => \app\conf\App::$param['path'] . "app/tmp/", 'lifeTime' => $lifetime);
     $Cache_Lite = new \Cache_Lite($options);
     if ($data = $Cache_Lite->get($id)) {
         //echo "Cached";
     } else {
         ob_start();
         $fileName = md5(time() . rand(10000, 99999) . microtime());
         $file = \app\conf\App::$param["path"] . "/app/tmp/_" . $fileName . "." . $type;
         $cmd = "wkhtmltoimage " . "--height {$sizeArr[1]} --disable-smart-width --width {$sizeArr[0]} --quality 90 --javascript-delay 1000 " . "\"" . "http://127.0.0.1" . "/api/v1/staticmap/html/{$db}?baselayer={$baseLayer}&layers={$layers}&center={$center}&zoom={$zoom}&size={$size}&bbox={$bbox}&sql={$sql}\" " . $file;
         //die($cmd);
         exec($cmd);
         switch ($type) {
             case "png":
                 $res = imagecreatefrompng($file);
                 break;
             case "jpg":
                 $res = imagecreatefromjpeg($file);
                 break;
         }
         if (!$res) {
             $response['success'] = false;
             $response['message'] = "Could not create image";
             $response['code'] = 406;
             header("HTTP/1.0 {$response['code']} " . \app\inc\Util::httpCodeText($response['code']));
             echo \app\inc\Response::toJson($response);
             exit;
         }
         header('Content-type: image/png');
         imageAlphaBlending($res, true);
         imageSaveAlpha($res, true);
         imagepng($res);
         // Cache script
         $data = ob_get_contents();
         $Cache_Lite->save($data, $id);
         ob_get_clean();
     }
     header("Content-type: image/png");
     echo $data;
     exit;
 }
开发者ID:ronaldoof,项目名称:geocloud2,代码行数:54,代码来源:Staticmap.php


示例13: LoadPNG

function LoadPNG($imgname)
{
    /* Attempt to open */
    $im = @imagecreatefrompng($imgname);
    /* See if it failed */
    if (!$im) {
        $im = @imagecreatefrompng("/usr/local/share/pbi-manager/icons/default.png");
    }
    imageAlphaBlending($im, true);
    imageSaveAlpha($im, true);
    return $im;
}
开发者ID:shabesoglu,项目名称:pcbsd,代码行数:12,代码来源:pbiicon.php


示例14: load

 /**
  * Load image
  *
  * @param string filename
  *
  * @return mixed none or a PEAR error object on error
  * @see PEAR::isError()
  */
 function load($image)
 {
     $this->uid = md5($_SERVER['REMOTE_ADDR']);
     $this->image = $image;
     $this->_get_image_details($image);
     $functionName = 'ImageCreateFrom' . $this->type;
     if (function_exists($functionName)) {
         $this->imageHandle = $functionName($this->image);
         if ($this->type == 'png') {
             imageAlphaBlending($this->imageHandle, false);
             imageSaveAlpha($this->imageHandle, true);
         }
     }
 }
开发者ID:blacksqr,项目名称:portable-nsd,代码行数:22,代码来源:GD.php


示例15: mergerImg

 private function mergerImg($imgs)
 {
     list($max_width, $max_height) = getimagesize($imgs['dst']);
     $dest = imagecreatefromjpeg($imgs['dst']);
     $src = imageCreateFromPng($imgs['src']);
     imageAlphaBlending($dest, true);
     imageSaveAlpha($dest, true);
     self::imagecopymerge_alpha($dest, $src, 0, 0, 0, 0, $max_width, $max_height, 100);
     $filename = $this->getFileName('jpg');
     // header("Content-type: image/jpeg");
     imagejpeg($dest, $filename, 80);
     imagedestroy($src);
     imagedestroy($dest);
     return $filename;
 }
开发者ID:sdgdsffdsfff,项目名称:h5,代码行数:15,代码来源:ImageSaver.php


示例16: do_icon

function do_icon($icon, $text, $color)
{
    $im = imagecreatefrompng($icon);
    imageAlphaBlending($im, true);
    imageSaveAlpha($im, true);
    $len = strlen($text);
    $p1 = $len <= 2 ? 1 : 2;
    $p2 = $len <= 2 ? 3 : 2;
    $px = (imagesx($im) - 7 * $len) / 2 + $p1;
    $font = 'arial.ttf';
    $contrast = $color ? imagecolorallocate($im, 255, 255, 255) : imagecolorallocate($im, 0, 0, 0);
    // white on dark?
    imagestring($im, $p2, $px, 3, $text, $contrast);
    // imagestring  ( $image, $font, $x, $y, $string, $color)
    imagepng($im);
    imagedestroy($im);
}
开发者ID:sharedgeo,项目名称:TicketsCAD-SharedGeo-Dev,代码行数:17,代码来源:gen_fac_icon.php


示例17: get_tms

 public function get_tms()
 {
     $parts = explode("/", $_SERVER['REQUEST_URI']);
     $url = "http://127.0.0.1/cgi/tilecache.py/{$parts[3]}/{$parts[4]}/{$parts[5]}/{$parts[6]}/{$parts[7]}?cfg={$this->db}";
     $res = imagecreatefrompng($url);
     if (!$res) {
         $response['success'] = false;
         $response['message'] = "Could create tile";
         $response['code'] = 406;
         header("HTTP/1.0 {$response['code']} " . \app\inc\Util::httpCodeText($response['code']));
         echo \app\inc\Response::toJson($response);
         exit;
     }
     header('Content-type: image/png');
     imageAlphaBlending($res, true);
     imageSaveAlpha($res, true);
     imagepng($res);
     exit;
 }
开发者ID:ronaldoof,项目名称:geocloud2,代码行数:19,代码来源:Wmsc.php


示例18: create_secimage

function create_secimage()
{
    global $image;
    $ret = array();
    $width = 250;
    $height = 100;
    $image = imagecreatetruecolor($width, $height);
    imageAlphaBlending($image, true);
    imageSaveAlpha($image, true);
    $color_1 = imagecolorallocate($image, 150, 150, 250);
    $color_2 = imagecolorallocate($image, 80, 80, 80);
    imageblend(0, 0, FIXED_GFX_PATH . "sec-gfx/bg.png", $image);
    /* 25/06/10 - AC: Disabled races logos for readability
    	$thumbs=array(FIXED_GFX_PATH."sec-gfx/cardassian.png",
    		FIXED_GFX_PATH."sec-gfx/dominion.png",
    		FIXED_GFX_PATH."sec-gfx/federation.png",
    		FIXED_GFX_PATH."sec-gfx/ferengi.png",
    	FIXED_GFX_PATH."sec-gfx/klingon.png",
    		FIXED_GFX_PATH."sec-gfx/romlulan.png");
    	shuffle($thumbs);
    
    	$t=0;
    	foreach ($thumbs as $value) 
    	{
    		imageblend($t*50,rand(0,$height-60),$value,$image);
    		$t++;
    	}*/
    for ($t = 0; $t < 6; $t++) {
        $color = imagecolorallocate($image, rand(40, 255), rand(40, 255), rand(40, 255));
        circle(rand(25, $width - 25), rand(25, $height - 25), 50, $color);
    }
    $color = imagecolorallocate($image, rand(40, 255), rand(40, 255), rand(40, 255));
    $pos[0] = rand(25, $width - 25);
    $pos[1] = rand(25, $height - 25);
    circle_sectioned($pos[0], $pos[1], 50, $color);
    $ret['center'] = implode(":", $pos);
    $md5 = md5(rand(0, 1000000));
    $ret['filename'] = 'tmpsec/sec' . $md5 . '.jpg';
    imagejpeg($image, $ret['filename'], 20);
    return $ret;
}
开发者ID:startrekfinalfrontier,项目名称:UI,代码行数:41,代码来源:secimage.php


示例19: crop

 public function crop($x0 = '', $y0 = '', $size, $width)
 {
     if (empty($size) || empty($width)) {
         throw new InvalidParamsException();
     }
     if (empty($x0) && empty($y0)) {
         $x0 = 0;
         $y0 = 0;
     }
     $height = $width * $this->height / $this->width;
     $x = $x0 * $this->width / $width;
     $y = $y0 * $this->height / $height;
     $newSize = $size * $this->height / $height;
     $newimageresource = imagecreatetruecolor(150, 150);
     imageAlphaBlending($newimageresource, false);
     imageSaveAlpha($newimageresource, true);
     imagecopyresampled($newimageresource, $this->getResource(), 0, 0, $x, $y, 150, 150, $newSize, $newSize);
     switch ($this->format) {
         case self::JPEG:
             $aname = "a" . time() . ".jpg";
             if (!imagejpeg($newimageresource, "avatars/" . $aname, 100)) {
                 throw new FileNotSaveException();
             }
             break;
         case self::GIF:
             $aname = "a" . time() . ".gif";
             if (!imagegif($newimageresource, "avatars/" . $aname)) {
                 throw new FileNotSaveException();
             }
             break;
         case self::PNG:
             $aname = "a" . time() . ".png";
             if (!imagepng($newimageresource, "avatars/" . $aname, 9)) {
                 throw new FileNotSaveException();
             }
             break;
     }
     return $aname;
 }
开发者ID:Klym,项目名称:flame,代码行数:39,代码来源:Avatar.class.php


示例20: create

 public function create(UserInterface $user, $picture, $overlay)
 {
     $width = 640;
     $height = 480;
     $dest_image = imagecreatetruecolor($width, $height);
     $filename = uniqid('', true) . '.png';
     $encodedData = str_replace(' ', '+', $overlay);
     $frame = imagecreatefrompng($encodedData);
     imageAlphaBlending($frame, true);
     imageSaveAlpha($frame, true);
     $encodedData = str_replace(' ', '+', $picture);
     $picture = imagecreatefrompng($encodedData);
     imageAlphaBlending($picture, true);
     imageSaveAlpha($picture, true);
     imagecopy($dest_image, $picture, 0, 0, 0, 0, $width, $height);
     imagecopy($dest_image, $frame, 0, 0, 0, 0, $width, $height);
     imagepng($dest_image, UPLOADS . $filename);
     imagedestroy($dest_image);
     $pic = new Picture();
     $pic->setUserId($user->getId())->setPath('/uploads/' . $filename)->setRealPath(UPLOADS . $filename);
     return $pic;
 }
开发者ID:jlagneau,项目名称:check-my-cam,代码行数:22,代码来源:PictureManager.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP imageAntiAlias函数代码示例发布时间:2022-05-15
下一篇:
PHP image函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap