說明 resource imagecreatetruecolor ( int $x_size , int $y_size ) imagecreatetruecolor() 返回一個圖像標識符,代表了一幅大小為 x_size " /> 国产a级黄色毛片,国产在线精彩视频,97人妻AV天天澡夜夜爽

天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

php imagecreatetruecolor 創建高清和透明圖片代碼小結

(php 4 >= 4.0.6, php 5)
imagecreatetruecolor ― 新建一個真彩色圖像

說明
resource imagecreatetruecolor ( int $x_size , int $y_size )
imagecreatetruecolor() 返回一個圖像標識符,代表了一幅大小為 x_size 和 y_size 的黑色圖像。

是否定義了本函數取決于 php 和 GD 的版本。從 php 4.0.6 到 4.1.x 只要加載了 GD 模塊本函數一直存在,但是在沒有安裝 GD2 的時候調用,php 將發出致命錯誤并退出。在 php 4.2.x 中此行為改為發出警告而不是錯誤。其它版本只在安裝了正確的 GD 版本時定義了本函數。

新建一個新的 GD 圖像流并輸出圖像
復制代碼 代碼如下:
<?php
header("Content-type: image/png");
$im = @imagecreatetruecolor(50, 100)
or die("Cannot Initialize new GD image stream");
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);
?>

Note: 本函數需要 GD 2.0.1 或更高版本(推薦 2.0.28 及更高版本)。

php imagecolorallocatealpha 創建透明圖片實例
imagecolorallocatealpha(resource $image , int $red , int $green , int $blue, int $alpha )
imagecolorallocatealpha()的行為相同imagecolorallocate()同阿爾法增加透明度參數。


$image
圖像資源,通過創造的圖像功能,如,一返回imagecreatetruecolor()。

$red
紅色分量的價值。

$green
價值的綠色成分。

$blue
藍色成分的價值。

$alpha
一個介于0和127的價值。 0表示完全不透明,而127表示完全透明。
來看個imagecolorallocatealpha實例教程
復制代碼 代碼如下:
<?php
$size = 300;
$image=imagecreatetruecolor($size, $size);

// something to get a white background with black border
$back = imagecolorallocate($image, 255, 255, 255);
$border = imagecolorallocate($image, 0, 0, 0);
imagefilledrectangle($image, 0, 0, $size - 1, $size - 1, $back);
imagerectangle($image, 0, 0, $size - 1, $size - 1, $border);

$yellow_x = 100;
$yellow_y = 75;
$red_x = 120;
$red_y = 165;
$blue_x = 187;
$blue_y = 125;
$radius = 150;

// allocate colors with alpha values
$yellow = imagecolorallocatealpha($image, 255, 255, 0, 75);
$red = imagecolorallocatealpha($image, 255, 0, 0, 75);
$blue = imagecolorallocatealpha($image, 0, 0, 255, 75);

// drawing 3 overlapped circle
imagefilledellipse($image, $yellow_x, $yellow_y, $radius, $radius, $yellow);
imagefilledellipse($image, $red_x, $red_y, $radius, $radius, $red);
imagefilledellipse($image, $blue_x, $blue_y, $radius, $radius, $blue);

// don't forget to output a correct header!
header('Content-type: image/png');

// and finally, output the result
imagepng($image);
imagedestroy($image);
?>


php imagecreatetruecolor創建高清圖片函數
imagecreatetruecolor()返回一個圖像標識符代表指定大小的黑色形象。

根據你的php和GD版本中函數定義與否。對于php 4.0.6通過4.1.x這個函數總是存在的

,如果廣東模塊加載,但它要求GD2的情況下被安裝了php將發出一個致命錯誤并退出。

php 4.2.x版這種行為是不同的人發出警告,而不是一個錯誤。其他版本只定義此功

能,

看看實例
復制代碼 代碼如下:
<?php
header ('Content-type: image/png');
$im = @imagecreatetruecolor(120, 20)
or die('Cannot Initialize new GD image stream');
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
imagepng($im);
imagedestroy($im);
?>


我提出這方面合作 - 結合一些例子,然后動態生成的文本。但是,與此設置,我能得

到透明背景的工作也。
復制代碼 代碼如下:
<?php
// Set the content-type

header('Content-type: image/png');

// Create the image
$im = imagecreatetruecolor(175, 15);
imagesavealpha($im, true);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 25, $black);
$trans_colour = imagecolorallocatealpha($im, 0, 0, 0, 127);
imagefill($im, 0, 0, $trans_colour);

// The text to draw
$text = $_GET['text'];
// Replace path by your own font path
$font = 'catriel regular.ttf';

// Add some shadow to the text
imagettftext($im, 9, 0, 13, 16, $black, $font, $text);

// Add the text
imagettftext($im, 9, 0, 12, 15, $white, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>

ph利用imagecreatetruecolor動態生成高清圖片代碼
復制代碼 代碼如下:
//實例用我們用imagecreatetruecolor
header ('Content-type: image/png');
$im = @imagecreatetruecolor(120, 20)
or die('Cannot Initialize new GD image stream');
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
imagepng($im);
imagedestroy($im);

//我把這個一起 - 結合較好的例子,然后動態生成的文本。但是,與此成立,我能得到透明背景以及工作。
//實例二imagecreatetruecolor
header('Content-type: image/png');

// Create the image
$im = imagecreatetruecolor(175, 15);
imagesavealpha($im, true);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 25, $black);
$trans_colour = imagecolorallocatealpha($im, 0, 0, 0, 127);
imagefill($im, 0, 0, $trans_colour);

// The text to draw
$text = $_GET['text'];
// Replace path by your own font path
$font = 'catriel regular.ttf';

// Add some shadow to the text
imagettftext($im, 9, 0, 13, 16, $black, $font, $text);

// Add the text
imagettftext($im, 9, 0, 12, 15, $white, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);

/*
實例三創建透明圖片

如果你想創建一個PNG圖像*透明*,其中的背景是完全透明的,所有行動發生在借鑒,除此之外,然后執行下列操作:
*/
$png = imagecreatetruecolor(800, 600);
imagesavealpha($png, true);

$trans_colour = imagecolorallocatealpha($png, 0, 0, 0, 127);
imagefill($png, 0, 0, $trans_colour);

$red = imagecolorallocate($png, 255, 0, 0);
imagefilledellips教程e($png, 400, 300, 400, 300, $red);

header("Content-type: image/png");
imagepng($png);

你要做的就是創建一個真正的彩色圖像,確保阿爾法保存狀態是,然后填寫一個顏色,也經歷了阿爾法級別設置為完全透明(127)的圖像。

從上面的代碼產生的巴新將有一個完全透明的背景(一紅色圓圈拖到Photoshop中的圖像,以了解自己)
The resulting PNG from the code above will have a red circle on a fully transparent background (drag the image into Photoshop to see for yourself)

php技術php imagecreatetruecolor 創建高清和透明圖片代碼小結,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 亚洲日韩天堂在线中文字幕 | 18禁无遮挡羞羞污污污污免费 | 一个人的HD高清在线观看 | 亚洲精品卡2卡3卡4卡5卡区 | 国产亚洲精品在浅麻豆 | 成人小视频免费在线观看 | 攻把受做哭边走边肉楼梯PLAY | 麻豆成人啪啪色婷婷久久 | 久久99国产精品蜜臀AV | 国产亚洲美女精品久久久2020 | 无码人妻丰满熟妇区五十路久久 | 四房播播开心色播 | 亚洲精品一区二区在线看片 | 教室眠催白丝美女校花 | 亚洲大片免费观看 | 97国产蝌蚪视频在线观看 | 亚洲精品久久一区二区三区四区 | 午夜电影三级还珠格格 | 欧美白人战黑吊 | 亚洲嫩草AV永久无码精品无码 | 亚洲AV久久无码精品蜜桃 | 贤妻良母电影日本 | 97欧美精品大香伊蕉在人线 | 最新国产av.在线视频 | 爽娇妻快高h | 在公交车上被JB草坏了被轮J了 | 91精品国产免费入口 | 色欲AV精品人妻一区二区三区 | 亚洲午夜精品久久久久久抢 | 国产成人精品免费视频大全可播放的 | 在线观看日本污污ww网站 | 久色视频网 | 久久精品麻豆国产天美传媒果冻 | 34g污奶绵uk甩奶 | 国产欧美二区综合 | 亚洲国产精品高清在线 | 伊人久久精品99热超碰 | 国产无线乱码一区二三区 | 亚洲乱码中文字幕久久 | J午夜精品久久久久久毛片 jzz大全18 | 理论片午午伦夜理片I |