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


PHP imageantialias函数代码示例

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


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

示例1: draw_heatmap

function draw_heatmap($image, &$clicks)
{
    if (function_exists('imageantialias')) {
        // Only available with compiled in version of GD
        imageantialias($image, true);
    }
    // Heatmap colors
    $blue = imagecolorallocate($image, 0, 0, 255);
    $lightblue = imagecolorallocate($image, 0, 63, 255);
    $seagreen = imagecolorallocate($image, 32, 178, 170);
    $greenyellow = imagecolorallocate($image, 173, 255, 47);
    $yellow = imagecolorallocate($image, 255, 255, 0);
    $orange = imagecolorallocate($image, 255, 165, 0);
    $orangered = imagecolorallocate($image, 255, 69, 0);
    $red = imagecolorallocate($image, 255, 0, 0);
    $pointsize = 40;
    colorcircle($image, &$clicks, $click, 10, $pointsize, $blue);
    colorcircle($image, &$clicks, $click, 15, $pointsize, $lightblue);
    colorcircle($image, &$clicks, $click, 20, $pointsize, $seagreen);
    colorcircle($image, &$clicks, $click, 25, $pointsize, $greenyellow);
    colorcircle($image, &$clicks, $click, 30, $pointsize, $yellow);
    colorcircle($image, &$clicks, $click, 35, $pointsize, $orange);
    colorcircle($image, &$clicks, $click, 40, $pointsize, $red);
    return true;
}
开发者ID:unswjasonhu,项目名称:airpollution_modeling,代码行数:25,代码来源:old_image_gen.php

示例2: output_image

 public function output_image($size = null)
 {
     if ($size != null) {
         $this->width = intval($size);
         $this->height = intval($size);
     }
     header("Content-type: image/{$this->imagetype_extension}");
     header("Content-disposition: inline; filename={$this->imagename}");
     $this->image = @imagecreatetruecolor($this->width + 1, $this->height + 1) or die("Could not create new Image!");
     imageantialias($this->image, true);
     $background = imagecolorallocate($this->image, 255, 255, 255);
     imagefill($this->image, 0, 0, $background);
     $max = 1000;
     $start = 40;
     $increment = 0;
     foreach ($this->lines as $line) {
         if ($increment >= $start and $increment < $max or true) {
             $this->drawcrease($line);
         }
         $increment++;
     }
     $f = $this->imagefunction;
     $f($this->image);
     // !
     imagedestroy($this->image);
 }
开发者ID:rschamp,项目名称:oripa-converter,代码行数:26,代码来源:CreasePattern.class.php

示例3: antialias

 public function antialias($enable = TRUE)
 {
     if (!Validator::isBool($enable)) {
         throw new IllegalArgumentException();
     }
     return imageantialias($this->imageResource, $enable);
 }
开发者ID:rendix2,项目名称:QW_MVS,代码行数:7,代码来源:Images.php

示例4: build

 function build($margin = 2, $bg = 'ffffff', $fg = '000000')
 {
     $TextBoxSize = $this->imagettfbbox($this->size, $this->angle, $this->font, preg_replace("/\\[nl\\]/is", "\r\n", $this->text));
     $TxtBx_Lwr_L_x = $TextBoxSize[0];
     $TxtBx_Lwr_L_y = $TextBoxSize[1];
     $TxtBx_Lwr_R_x = $TextBoxSize[2];
     $TxtBx_Lwr_R_y = $TextBoxSize[3];
     $TxtBx_Upr_R_x = $TextBoxSize[4];
     $TxtBx_Upr_R_y = $TextBoxSize[5];
     $TxtBx_Upr_L_x = $TextBoxSize[6];
     $TxtBx_Upr_L_y = $TextBoxSize[7];
     if ($this->angle <= 90 || $this->angle >= 270) {
         $width = max($TxtBx_Lwr_R_x, $TxtBx_Upr_R_x) - min($TxtBx_Lwr_L_x, $TxtBx_Upr_L_x);
         $height = max($TxtBx_Lwr_L_y, $TxtBx_Lwr_R_y) - min($TxtBx_Upr_R_y, $TxtBx_Upr_L_y);
         $x = -min($TxtBx_Upr_L_x, $TxtBx_Lwr_L_x);
         $y = -min($TxtBx_Upr_R_y, $TxtBx_Upr_L_y);
     } else {
         $width = max($TxtBx_Lwr_L_x, $TxtBx_Upr_L_x) - min($TxtBx_Lwr_R_x, $TxtBx_Upr_R_x);
         $height = max($TxtBx_Upr_R_y, $TxtBx_Upr_L_y) - min($TxtBx_Lwr_L_y, $TxtBx_Lwr_R_y);
         $x = -min($TxtBx_Lwr_R_x, $TxtBx_Upr_R_x);
         $y = -min($TxtBx_Lwr_L_y, $TxtBx_Lwr_R_y);
     }
     $this->img = imagecreate($width + $margin, $height + $margin);
     // Only PHP-Version 4.3.2 or higher
     if (function_exists('imageantialias')) {
         imageantialias($this->img, true);
     }
     $bgc = $this->imagecolorallocate($bg);
     $fgc = $this->imagecolorallocate($fg);
     imagefill($this->img, 0, 0, $bgc);
     imagecolortransparent($this->img, $bgc);
     imagettftext($this->img, $this->size, $this->angle, $x + ceil($margin / 2), $y + ceil($margin / 2), $fgc, $this->font, preg_replace("/\\[nl\\]/is", "\r\n", $this->text));
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:33,代码来源:class.text2image.php

示例5: create_error

 function create_error($text)
 {
     $text = $text;
     $size = "8";
     $font = "classes/fonts/trebuchet.ttf";
     $TextBoxSize = imagettfbbox($size, 0, $font, preg_replace("/\\[br\\]/is", "\r\n", $text));
     $TxtBx_Lwr_L_x = $TextBoxSize[0];
     $TxtBx_Lwr_L_y = $TextBoxSize[1];
     $TxtBx_Lwr_R_x = $TextBoxSize[2];
     $TxtBx_Lwr_R_y = $TextBoxSize[3];
     $TxtBx_Upr_R_x = $TextBoxSize[4];
     $TxtBx_Upr_R_y = $TextBoxSize[5];
     $TxtBx_Upr_L_x = $TextBoxSize[6];
     $TxtBx_Upr_L_y = $TextBoxSize[7];
     $width = max($TxtBx_Lwr_R_x, $TxtBx_Upr_R_x) - min($TxtBx_Lwr_L_x, $TxtBx_Upr_L_x);
     $height = max($TxtBx_Lwr_L_y, $TxtBx_Lwr_R_y) - min($TxtBx_Upr_R_y, $TxtBx_Upr_L_y);
     $x = -min($TxtBx_Upr_L_x, $TxtBx_Lwr_L_x);
     $y = -min($TxtBx_Upr_R_y, $TxtBx_Upr_L_y);
     $img = imagecreate($width + 2, $height + 1);
     // Only PHP-Version 4.3.2 or higher
     if (function_exists('imageantialias')) {
         imageantialias($img, FALSE);
     }
     $white = imagecolorallocate($img, 255, 255, 255);
     $black = imagecolorallocate($img, 0, 0, 0);
     imagecolortransparent($img, $white);
     ImageTTFText($img, $size, 0, $x, $y, $black, $font, preg_replace("/<br>/is", "\r\n", $text));
     header("Content-Type: image/png");
     ImagePNG($img);
     ImageDestroy($img);
     exit;
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:32,代码来源:class.thumbnail.php

示例6: index

 /**
  * 输出图片
  * 
  * @param  string $size     [description]
  * @param  string $bgcolor  [description]
  * @param  string $color    [description]
  * @param  string $text     [description]
  * @param  [type] $fontsize [description]
  * @return [type]           [description]
  */
 public function index($size = '100x100', $bgcolor = 'ccc', $color = '555', $text = '', $fontsize = NULL)
 {
     $cache_filepath = storage_path('placeholders/' . md5(serialize(func_get_args())) . '.png');
     if (!file_exists($cache_filepath)) {
         // Dimensions
         list($width, $height) = explode('x', $size);
         empty($height) && ($height = $width);
         $bgcolor = hex2rgb($bgcolor);
         $color = hex2rgb($color);
         empty($text) && ($text = $width . ' x ' . $height);
         //$hash_key = md5(serialize(compact('width','height','bgcolor','color','text')));
         // Create image
         $image = imagecreate($width, $height);
         // Colours
         $setbg = imagecolorallocate($image, $bgcolor['r'], $bgcolor['g'], $bgcolor['b']);
         $fontcolor = imagecolorallocate($image, $color['r'], $color['g'], $color['b']);
         // Text positioning
         empty($fontsize) && ($fontsize = $width > $height ? $height / 10 : $width / 10);
         $font = APPPATH . 'static/common/fonts/msyh.ttf';
         $fontbox = calculate_textbox($fontsize, 0, $font, $text);
         // Generate text
         function_exists('imageantialias') && imageantialias($image, true);
         imagettftext($image, $fontsize, 0, ceil(($width - $fontbox['width']) / 2 + $fontbox['left']), ceil(($height - $fontbox['height']) / 2 + $fontbox['top']), $fontcolor, $font, $text);
         // Render image
         imagepng($image, $cache_filepath);
         imagedestroy($image);
     }
     return response()->preview($cache_filepath, ['Content-Type' => 'image/png']);
 }
开发者ID:unionbt,项目名称:hanpaimall,代码行数:39,代码来源:PlaceholderController.php

示例7: wp_crop_image

/**
 * Crop an Image to a given size.
 *
 * @since 2.1.0
 *
 * @param string|int $src_file The source file or Attachment ID.
 * @param int $src_x The start x position to crop from.
 * @param int $src_y The start y position to crop from.
 * @param int $src_w The width to crop.
 * @param int $src_h The height to crop.
 * @param int $dst_w The destination width.
 * @param int $dst_h The destination height.
 * @param int $src_abs Optional. If the source crop points are absolute.
 * @param string $dst_file Optional. The destination file to write to.
 * @return string New filepath on success, String error message on failure.
 */
function wp_crop_image($src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false)
{
    if (is_numeric($src_file)) {
        // Handle int as attachment ID
        $src_file = get_attached_file($src_file);
    }
    $src = wp_load_image($src_file);
    if (!is_resource($src)) {
        return $src;
    }
    $dst = wp_imagecreatetruecolor($dst_w, $dst_h);
    if ($src_abs) {
        $src_w -= $src_x;
        $src_h -= $src_y;
    }
    if (function_exists('imageantialias')) {
        imageantialias($dst, true);
    }
    imagecopyresampled($dst, $src, 0, 0, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
    imagedestroy($src);
    // Free up memory
    if (!$dst_file) {
        $dst_file = str_replace(basename($src_file), 'cropped-' . basename($src_file), $src_file);
    }
    $dst_file = preg_replace('/\\.[^\\.]+$/', '.jpg', $dst_file);
    if (imagejpeg($dst, $dst_file, apply_filters('jpeg_quality', 90, 'wp_crop_image'))) {
        return $dst_file;
    } else {
        return false;
    }
}
开发者ID:bluedanbob,项目名称:wordpress,代码行数:47,代码来源:image.php

示例8: create

	function create($Width, $Height) {
		$this->Image = imagecreate($Width, $Height);
		$this->Font = SERVER_ROOT.'/classes/fonts/VERDANA.TTF';
		if(function_exists('imageantialias')){
			imageantialias($this->Image, true);
		}
	}
开发者ID:4play,项目名称:gazelle2,代码行数:7,代码来源:class_image.php

示例9: _textToImage

 private function _textToImage()
 {
     $bgc = $this->_bgcolor;
     $fgc = $this->_fgcolor;
     $str = wordwrap(urldecode(stripslashes($this->_text)), 50, "\n", 1);
     $lines = explode("\n", $str);
     $longest = '';
     foreach ($lines as $l) {
         if (strlen($l) > strlen($longest)) {
             $longest = $l;
         }
     }
     $tl = count($lines);
     $w = $this->_textWidth($this->_font, $longest, $this->_size) + 25;
     $h = $tl * ($this->_size * ($tl > 1 ? 1.5 : 2));
     $im = imagecreatetruecolor($w, $h);
     imagealphablending($im, true);
     imageantialias($im, true);
     $bg = imagecolorallocatealpha($im, $bgc['r'], $bgc['g'], $bgc['b'], $bgc['a']);
     $fg = imagecolorallocatealpha($im, $fgc['r'], $fgc['g'], $fgc['b'], $fgc['a']);
     imagefill($im, 0, 0, $bg);
     $x = 10;
     $y = $this->_size * 1.5;
     foreach ($lines as $l) {
         imagettftext($im, $this->_size, 0, $x, $y, $fg, $this->_font, $l);
         $y += $fh * 1.5;
     }
     if (file_exists($this->_CACHE_PATH)) {
         unlink($this->_CACHE_PATH);
     }
     imagepng($im, $this->_CACHE_PATH);
     return $im;
 }
开发者ID:raisanen,项目名称:Thebes-theme,代码行数:33,代码来源:text_to_image.php

示例10: draw_captcha

function draw_captcha($security_code)
{
    //Set the image width and height
    $width = 100;
    $height = 25;
    //Create the image resource
    $image = ImageCreate($width, $height);
    if (function_exists('imageantialias')) {
        imageantialias($image, true);
    }
    //We are making three colors, white, black and gray
    $white = ImageColorAllocate($image, 255, 255, 255);
    $black = ImageColorAllocate($image, 15, 50, 15);
    $grey = ImageColorAllocate($image, 204, 204, 204);
    $ellipsec = ImageColorAllocate($image, 0, 100, 60);
    //Make the background black
    ImageFill($image, 0, 0, $black);
    imagefilledellipse($image, 56, 15, 30, 17, $ellipsec);
    //Add randomly generated string in white to the image
    ImageString($image, 5, 30, 4, $security_code, $white);
    //Throw in some lines to make it a little bit harder for any bots to break
    ImageRectangle($image, 0, 0, $width - 1, $height - 1, $grey);
    imageline($image, 0, $height / 2 + 3, $width, $height / 2 + 5, $grey);
    imageline($image, $width / 2 - 14, 0, $width / 2 + 7, $height, $grey);
    //Tell the browser what kind of file is come in
    header("Content-Type: image/jpeg");
    //Output the newly created image in jpeg format
    ImageJpeg($image);
    //Free up resources
    ImageDestroy($image);
}
开发者ID:kuell,项目名称:chat,代码行数:31,代码来源:captcha.php

示例11: resize

 /**
  * Resizes image
  * @param string $src path to image
  * @param array $params resize parameters
  * @return array content and format
  */
 public static function resize($src, $params)
 {
     $img_functions = self::supportedFormats();
     $ext = $params['ext'];
     $new_width = $params['new_width'];
     $new_height = $params['new_height'];
     $dst_width = $params['dst_width'];
     $dst_height = $params['dst_height'];
     $width = $params['width'];
     $height = $params['height'];
     $bg_color = $params['bg_color'];
     $convert_to = $params['convert_to'];
     $jpeg_quality = $params['jpeg_quality'];
     $x = $params['x'];
     $y = $params['y'];
     $dst = imagecreatetruecolor($dst_width, $dst_height);
     if (function_exists('imageantialias')) {
         imageantialias($dst, true);
     }
     if ($ext == 'gif') {
         $new = imagecreatefromgif($src);
     } elseif ($ext == 'jpg') {
         $new = imagecreatefromjpeg($src);
     } elseif ($ext == 'png') {
         $new = imagecreatefrompng($src);
     }
     list($r, $g, $b) = empty($bg_color) ? fn_parse_rgb('#ffffff') : fn_parse_rgb($bg_color);
     $c = imagecolorallocate($dst, $r, $g, $b);
     if (empty($bg_color) && ($ext == 'png' || $ext == 'gif')) {
         if (function_exists('imagecolorallocatealpha') && function_exists('imagecolortransparent') && function_exists('imagesavealpha') && function_exists('imagealphablending')) {
             $c = imagecolorallocatealpha($dst, 255, 255, 255, 127);
             imagecolortransparent($dst, $c);
             imagesavealpha($dst, true);
             imagealphablending($dst, false);
         }
     }
     imagefilledrectangle($dst, 0, 0, $dst_width, $dst_height, $c);
     imagecopyresampled($dst, $new, $x, $y, 0, 0, $new_width, $new_height, $width, $height);
     // Free memory from image
     imagedestroy($new);
     if ($convert_to == 'original') {
         $convert_to = $ext;
     } elseif (!empty($img_functions[$convert_to])) {
         $convert_to = $convert_to;
     } else {
         $convert_to = key($img_functions);
     }
     ob_start();
     if ($convert_to == 'gif') {
         imagegif($dst);
     } elseif ($convert_to == 'jpg') {
         imagejpeg($dst, null, $jpeg_quality);
     } elseif ($convert_to == 'png') {
         imagepng($dst);
     }
     $content = ob_get_clean();
     imagedestroy($dst);
     return array($content, $convert_to);
 }
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:65,代码来源:Gd.php

示例12: generate

 public function generate($f_image, $n_image)
 {
     ImageFilledArc($f_image, $this->_width, $this->_height, $this->_width * 2, $this->_height * 2, 0, 300, $this->_completeColorAllocate, IMG_ARC_PIE);
     ImageFilledArc($f_image, $this->_width, $this->_height, $this->_width * 2, $this->_height * 2, 300, 360, $this->_incompleteColorAllocate, IMG_ARC_PIE);
     imageantialias($n_image, true);
     imagecopyresampled($n_image, $f_image, 0, 0, 0, 0, $this->_width, $this->_height, $this->_width * 2, $this->_height * 2);
     return $this;
 }
开发者ID:besters,项目名称:My-Base,代码行数:8,代码来源:Pie.php

示例13: Initialize

 public function Initialize()
 {
     $this->mImg = imagecreatetruecolor($this->mWidth, $this->mHeight);
     imageantialias($this->mImg, $this->mAntialiasing);
     $this->mBlack = imagecolorallocate($this->mImg, 0, 0, 0);
     $this->mWhite = imagecolorallocate($this->mImg, 255, 255, 255);
     imagefill($this->mImg, 0, 0, $this->mWhite);
 }
开发者ID:eXcomm,项目名称:alive,代码行数:8,代码来源:gd.php

示例14: make_thumbnail_GD

 private function make_thumbnail_GD($src_path, $width, $height, $dest)
 {
     $size = @getimagesize($src_path);
     if ($size === false) {
         return false;
     }
     // не удалось получить параметры файла;
     $w = $size[0];
     $h = $size[1];
     $format = strtolower(substr($size['mime'], strpos($size['mime'], '/') + 1));
     // Создаем ресурс картинки
     $image = @imagecreatefromstring(file_get_contents($src_path));
     if (!is_resource($image)) {
         return false;
     }
     // не получилось получить картинку
     // если не указана одна из сторон задаем ей пропорциональное значение
     if (!$width) {
         $width = round($w * ($height / $h));
     }
     if (!$height) {
         $height = round($h * ($width / $w));
     }
     // Создаем холст полноцветного изображения
     $thumb = imagecreatetruecolor($width, $height);
     if (function_exists('imagealphablending') && function_exists('imagesavealpha')) {
         imagealphablending($thumb, false);
         // режим сопряжения цвета и альфа цвета
         imagesavealpha($thumb, true);
         // флаг сохраняющий прозрачный канал
     }
     if (function_exists('imageantialias')) {
         imageantialias($thumb, true);
     }
     // включим функцию сглаживания
     list($dx, $dy, $wsrc, $hsrc) = $this->crop_coordinates($height, $h, $width, $w);
     if (!imagecopyresampled($thumb, $image, 0, 0, $dx, $dy, $width, $height, $wsrc, $hsrc)) {
         return false;
     }
     // не удалось изменить размер
     //
     // Сохраняем картинку
     if ($format == 'png') {
         // convert from full colors to index colors, like original PNG.
         if (function_exists('imageistruecolor') && !imageistruecolor($thumb)) {
             imagetruecolortopalette($thumb, false, imagecolorstotal($thumb));
         }
         imagepng($thumb, $dest);
     } elseif ($format == 'gif') {
         imagegif($thumb, $dest);
     } else {
         imagejpeg($thumb, $dest, 85);
     }
     chmod($dest, 0755);
     imagedestroy($image);
     imagedestroy($thumb);
     return true;
 }
开发者ID:stanislav-chechun,项目名称:campus-rize,代码行数:58,代码来源:rcl_crop.php

示例15: SetAntiAliasing

 function SetAntiAliasing($aFlg = true)
 {
     $this->use_anti_aliasing = $aFlg;
     if (function_exists('imageantialias')) {
         imageantialias($this->img, $aFlg);
     } else {
         //JpGraphError::RaiseL(25128);//('The function imageantialias() is not available in your PHP installation. Use the GD version that comes with PHP and not the standalone version.')
     }
 }
开发者ID:josimarjimenez,项目名称:architects,代码行数:9,代码来源:gd_image.inc.php


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