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

PHP imageTrueColorToPalette函数代码示例

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

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



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

示例1: colorize

 static function colorize($image, $rgb_code)
 {
     imageTrueColorToPalette($image, true, 256);
     $num_colors = imageColorsTotal($image);
     for ($x = 0; $x < $num_colors; $x++) {
         list($r, $g, $b) = array_values(imageColorsForIndex($image, $x));
         $gray_scale = ($r + $g + $b) / 3 / 0xff;
         imageColorSet($image, $x, $gray_scale * $rgb_code[0], $gray_scale * $rgb_code[1], $gray_scale * $rgb_code[2]);
     }
 }
开发者ID:Zortex04,项目名称:habbo-web-cms,代码行数:10,代码来源:GroupImager.php


示例2: Colorize

function Colorize($IMG, $RGB)
{
    imageTrueColorToPalette($IMG, true, 256);
    $numColors = imageColorsTotal($IMG);
    for ($x = 0; $x < $numColors; $x++) {
        list($r, $g, $b) = array_values(imageColorsForIndex($IMG, $x));
        $grayscale = ($r + $g + $b) / 3 / 0xff;
        imageColorSet($IMG, $x, $grayscale * $RGB[0], $grayscale * $RGB[1], $grayscale * $RGB[2]);
    }
}
开发者ID:habb0,项目名称:mobbo,代码行数:10,代码来源:badge.php


示例3: __write

 /**
  * Write the image after being processed
  *
  * @param Asido_TMP &$tmp
  * @return boolean
  * @access protected
  */
 function __write(&$tmp)
 {
     // try to guess format from extension
     //
     if (!$tmp->save) {
         $p = pathinfo($tmp->target_filename);
         ($tmp->save = $this->__mime_metaphone[metaphone($p['extension'])]) || ($tmp->save = $this->__mime_soundex[soundex($p['extension'])]);
     }
     $result = false;
     $imgContent = null;
     switch ($tmp->save) {
         case 'image/gif':
             imageTrueColorToPalette($tmp->target, true, 256);
             ob_start();
             $result = @imageGIF($tmp->target);
             $imgContent = ob_get_clean();
             break;
         case 'image/jpeg':
             ob_start();
             $result = @imageJPEG($tmp->target, null, ASIDO_GD_JPEG_QUALITY);
             $imgContent = ob_get_clean();
             break;
         case 'image/wbmp':
             ob_start();
             $result = @imageWBMP($tmp->target);
             $imgContent = ob_get_clean();
             break;
         default:
         case 'image/png':
             imageSaveAlpha($tmp->target, true);
             imageAlphaBlending($tmp->target, false);
             ob_start();
             $result = @imagePNG($tmp->target, null, ASIDO_GD_PNG_QUALITY);
             $imgContent = ob_get_clean();
             break;
     }
     if ($result) {
         jimport('joomla.filesystem.file');
         JFile::write($tmp->target_filename, $imgContent);
     }
     @$this->__destroy_source($tmp);
     @$this->__destroy_target($tmp);
     return $result;
 }
开发者ID:ashanrupasinghe,项目名称:dnp,代码行数:51,代码来源:class.driver.gd.php


示例4: image_colorize

 public function image_colorize($rgb)
 {
     imageTrueColorToPalette($this->imageResized, true, 256);
     $numColors = imageColorsTotal($this->imageResized);
     for ($x = 0; $x < $numColors; $x++) {
         list($r, $g, $b) = array_values(imageColorsForIndex($this->imageResized, $x));
         // calculate grayscale in percent
         $grayscale = ($r + $g + $b) / 3 / 0xff;
         imageColorSet($this->imageResized, $x, $grayscale * $rgb[0], $grayscale * $rgb[1], $grayscale * $rgb[2]);
     }
     return true;
 }
开发者ID:WebPassions,项目名称:2015,代码行数:12,代码来源:php_image_magician.php


示例5: __write

 /**
  * Write the image after being processed
  *
  * @param Asido_TMP &$tmp
  * @return boolean
  * @access protected
  */
 function __write(&$tmp)
 {
     // try to guess format from extension
     //
     if (!$tmp->save) {
         $p = pathinfo($tmp->target_filename);
         ($tmp->save = $this->__mime_metaphone[metaphone($p['extension'])]) || ($tmp->save = $this->__mime_soundex[soundex($p['extension'])]);
     }
     $result = false;
     switch ($tmp->save) {
         case 'image/gif':
             imageTrueColorToPalette($tmp->target, true, 256);
             $result = @imageGIF($tmp->target, $tmp->target_filename);
             break;
         case 'image/jpeg':
             $result = @imageJPEG($tmp->target, $tmp->target_filename, ASIDO_GD_JPEG_QUALITY);
             break;
         case 'image/wbmp':
             $result = @imageWBMP($tmp->target, $tmp->target_filename);
             break;
         default:
         case 'image/png':
             imageSaveAlpha($tmp->target, true);
             imageAlphaBlending($tmp->target, false);
             $result = @imagePNG($tmp->target, $tmp->target_filename);
             break;
     }
     @$this->__destroy_source($tmp);
     @$this->__destroy_target($tmp);
     return $result;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:38,代码来源:class.driver.gd.php


示例6: image_colorize4

 function image_colorize4(&$img, $rgb)
 {
     imageTrueColorToPalette($img, true, 256);
     $numColors = imageColorsTotal($img);
     for ($x = 0; $x < $numColors; $x++) {
         list($r, $g, $b) = array_values(imageColorsForIndex($img, $x));
         $grayscale = ($r + $g + $b) / 3 / 0xff;
         imageColorSet($img, $x, $grayscale * $rgb[0], $grayscale * $rgb[1], $grayscale * $rgb[2]);
     }
 }
开发者ID:habb0,项目名称:HabboPHP,代码行数:10,代码来源:badge.php


示例7: confirmImage

    /**
     * 	Функция генерирует и выводит хидер PNG и изображение с кодом подтверждения (код берется из массива полей)
     * 	Возвращает результат выполнения imagePNG
     * 	@return	bool
     */
    function confirmImage() {

        $width = ajaxform::$captcha[width];
        $height = ajaxform::$captcha[height];

        $multi = 4;
        $xwidth = $width * $multi;
        $xheight = $height * $multi;

        $code = $this->fields[confirm][value];

        $im = imageCreateTrueColor($xwidth, $xheight);
        $w = imageColorAllocate($im, 255, 255, 255);
        $b = imageColorAllocate($im, 000, 000, 000);
        $g = imageColorAllocate($im, 100, 100, 100);
        imageFill($im, 1, 1, $w);
        $w = imageColorTransparent($im, $w);

        $r = mt_rand(0, $xheight);
        for ($x = 0; $x < $xwidth + $xheight; $x += 4 * $multi) {

            for ($i = 0; $i < $multi; $i++)
                imageLine($im, $x + $i, 0, $x + $i - $xheight, $xheight + $r, $g);
        }

        $arr = preg_split('//', $code, -1, PREG_SPLIT_NO_EMPTY);
        for ($i = 0; $i < count($arr); $i++) {

            $x = ($xwidth * 0.04) + (floor(($xwidth * 0.97) * 0.167)) * $i; // разрядка
            $y = ($xheight * 0.8);
            $s = ($xheight * 0.5) * (96 / 72); // 96 — res
            $a = mt_rand(-20, 20);

            imageTTFText($im, $s, $a, $x, $y, $b, $_SERVER[DOCUMENT_ROOT] . "/lib/core/classes/form_ajax/consolas.ttf", $arr[$i]); //
        }

        $temp = imageCreateTrueColor($xwidth, $xheight);
        $w = imageColorAllocate($temp, 255, 255, 255);
        imageFill($temp, 1, 1, $w);
        $w = imageColorTransparent($temp, $w);

        $phase = rand(-M_PI, M_PI);
        $frq = 2 * M_PI / $xheight;
        $amp = $xwidth * 0.02;

        for ($y = 0; $y < $xheight; $y++) {

            $dstx = $amp + sin($y * $frq + $phase) * $amp;

            imagecopy($temp, $im, $dstx, $y, 0, $y, $xwidth, 1);
            //imagesetpixel($im, $dstx, $y, $b);
        }

        $res = imageCreateTrueColor($width, $height);
        $w = imageColorAllocate($res, 255, 255, 255);
        imageFill($res, 1, 1, $w);
        $w = imageColorTransparent($res, $w);

        imageCopyResampled($res, $temp, 0, 0, 0, 0, $width, $height, $xwidth, $xheight);

        imageTrueColorToPalette($res, true, 256);

        header("CONTENT-TYPE: IMAGE/PNG");
        return imagePNG($res);
    }
开发者ID:GGF,项目名称:baza4,代码行数:70,代码来源:ajaxform.class.php


示例8: __write

 /**
  * Write the image after being processed
  *
  * @param Asido_TMP &$tmp
  * @return boolean
  * @access protected
  */
 function __write(&$tmp)
 {
     // try to guess format from extension
     //
     if (!$tmp->save) {
         $p = pathinfo($tmp->target_filename);
         ($tmp->save = $this->__mime_metaphone[metaphone($p['extension'])]) || ($tmp->save = $this->__mime_soundex[soundex($p['extension'])]);
     }
     $result = false;
     switch ($tmp->save) {
         case 'image/gif':
             imageTrueColorToPalette($tmp->target, true, 256);
             ob_start();
             imageGIF($tmp->target);
             $contents = ob_get_contents();
             ob_end_clean();
             break;
         case 'image/jpeg':
             ob_start();
             imageJPEG($tmp->target, null, ASIDO_GD_JPEG_QUALITY);
             $contents = ob_get_contents();
             ob_end_clean();
             break;
         case 'image/wbmp':
             ob_start();
             imageWBMP($tmp->target);
             $contents = ob_get_contents();
             ob_end_clean();
             break;
         default:
         case 'image/png':
             imageSaveAlpha($tmp->target, true);
             imageAlphaBlending($tmp->target, false);
             ob_start();
             imagePNG($tmp->target);
             $contents = ob_get_contents();
             ob_end_clean();
             break;
     }
     // This needs to go through Joomla as suexec might be present
     jimport('joomla.filesystem');
     $result = JFile::write($tmp->target_filename, $contents);
     $this->__destroy_source($tmp);
     $this->__destroy_target($tmp);
     return $result;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:53,代码来源:class.driver.gd_hack.php


示例9: count

        $arcount++;
    }
    $deletedays = count($data_array);
    $first_entry = 10;
    // disable tsgk map function
    if (count($data_array) > 1) {
        drawItems($image, array('width' => $width, 'height' => $height, 'indent_x' => $indent_x, 'indent_y' => $indent_y), $data_array, 0, 'kills', 0, 1, 0, 1, array($red, $red, $font_color, $dark_color, $light_gray));
        drawItems($image, array('width' => $width, 'height' => $height, 'indent_x' => $indent_x, 'indent_y' => $indent_y), $data_array, 0, 'headshots', 0, 0, 0, 1, array($dark_color, $red, $font_color, $dark_color, $light_gray));
        drawItems($image, array('width' => $width, 'height' => $height, 'indent_x' => $indent_x, 'indent_y' => $indent_y), $data_array, 0, 'skill', 0, 0, 0, 1, array($orange, $red, $font_color, $dark_color, $light_gray));
        drawItems($image, array('width' => $width, 'height' => $height, 'indent_x' => $indent_x, 'indent_y' => $indent_y), $data_array, 2, 'deaths', 0, 0, 0, 1, array($gray, $red, $font_color, $dark_color, $light_gray));
    }
    $str = $deletedays . ' days Trend';
    $str_width = imagefontwidth(1) * strlen($str) + 2;
    imagestring($image, 1, $width - $indent_x[1] - $str_width, $indent_y[0] - 11, $str, $font_color);
}
imageTrueColorToPalette($image, 0, 65535);
// $bar_type=2;
// achtung, hier ist noch ein pfad hardcoded!!!
header('Content-Type: image/png');
if ($bar_type != 2) {
    @imagepng($image, IMAGE_PATH . '/progress/server_' . $width . '_' . $height . '_' . $bar_type . '_' . $game . '_' . $server_id . '_' . $bg_id . '_' . $server_load_type . '.png');
    $mod_date = date('D, d M Y H:i:s \\G\\M\\T', time());
    header('Last-Modified:' . $mod_date);
    imagepng($image);
    imagedestroy($image);
    //Opera doesn't like the redirect
    /*$mod_date = date('D, d M Y H:i:s \G\M\T', time());
    		header('Last-Modified:'.$mod_date);
    		header("Location: ".IMAGE_PATH."/progress/server_".$width."_".$height."_".$bar_type."_".$game."_".$server_id."_".$bg_id."_".$server_load_type.".png");*/
} else {
    imagepng($image);
开发者ID:PitbullOL,项目名称:insurgency-hlstatsx,代码行数:31,代码来源:show_graph.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP imageWBMP函数代码示例发布时间:2022-05-15
下一篇:
PHP imageTextSize函数代码示例发布时间: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