說(shuō)明 resource imagecreatetruecolor ( int $x_size , int $y_size ) imagecreatetruecolor() 返回一個(gè)圖像標(biāo)識(shí)符,代表了一幅大小為 x_size " /> 跪求黄色网址,国产一级大片,欧美一区二区三区视频

中文字幕日韩一区二区_国产一区二区av_国产毛片av_久久久久国产一区_色婷婷电影_国产一区二区精品

php imagecreatetruecolor 創(chuàng)建高清和透明圖片代碼小結(jié)

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

說(shuō)明
resource imagecreatetruecolor ( int $x_size , int $y_size )
imagecreatetruecolor() 返回一個(gè)圖像標(biāo)識(shí)符,代表了一幅大小為 x_size 和 y_size 的黑色圖像。

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

新建一個(gè)新的 GD 圖像流并輸出圖像
復(fù)制代碼 代碼如下:
<?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: 本函數(shù)需要 GD 2.0.1 或更高版本(推薦 2.0.28 及更高版本)。

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


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

$red
紅色分量的價(jià)值。

$green
價(jià)值的綠色成分。

$blue
藍(lán)色成分的價(jià)值。

$alpha
一個(gè)介于0和127的價(jià)值。 0表示完全不透明,而127表示完全透明。
來(lái)看個(gè)imagecolorallocatealpha實(shí)例教程
復(fù)制代碼 代碼如下:
<?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創(chuàng)建高清圖片函數(shù)
imagecreatetruecolor()返回一個(gè)圖像標(biāo)識(shí)符代表指定大小的黑色形象。

根據(jù)你的php和GD版本中函數(shù)定義與否。對(duì)于php 4.0.6通過(guò)4.1.x這個(gè)函數(shù)總是存在的

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

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

能,

看看實(shí)例
復(fù)制代碼 代碼如下:
<?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);
?>


我提出這方面合作 - 結(jié)合一些例子,然后動(dòng)態(tài)生成的文本。但是,與此設(shè)置,我能得

到透明背景的工作也。
復(fù)制代碼 代碼如下:
<?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動(dòng)態(tài)生成高清圖片代碼
復(fù)制代碼 代碼如下:
//實(shí)例用我們用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);

//我把這個(gè)一起 - 結(jié)合較好的例子,然后動(dòng)態(tài)生成的文本。但是,與此成立,我能得到透明背景以及工作。
//實(shí)例二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);

/*
實(shí)例三創(chuàng)建透明圖片

如果你想創(chuàng)建一個(gè)PNG圖像*透明*,其中的背景是完全透明的,所有行動(dòng)發(fā)生在借鑒,除此之外,然后執(zhí)行下列操作:
*/
$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);

你要做的就是創(chuàng)建一個(gè)真正的彩色圖像,確保阿爾法保存狀態(tài)是,然后填寫(xiě)一個(gè)顏色,也經(jīng)歷了阿爾法級(jí)別設(shè)置為完全透明(127)的圖像。

從上面的代碼產(chǎn)生的巴新將有一個(gè)完全透明的背景(一紅色圓圈拖到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技術(shù)php imagecreatetruecolor 創(chuàng)建高清和透明圖片代碼小結(jié),轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 日韩欧美在线观看视频 | 一级黄色大片 | 国产精品美女久久久久久久网站 | 美女国产| 国产精品久久久久久久免费观看 | 99九色| 日日夜夜91 | 国产精品视频网 | h视频免费在线观看 | 日韩一区二区三区视频 | 久久国产综合 | 三级视频在线观看电影 | 日本在线一区二区 | 国产在线一区二区三区 | 日韩久久久久久 | 久久国产视频播放 | 五月婷亚洲 | 在线观看国产视频 | 成年人黄色免费视频 | 在线观看国产 | 久久国产高清 | 国产亚洲日本精品 | 亚洲激精日韩激精欧美精品 | a国产一区二区免费入口 | 伊人激情网 | 在线观看成人小视频 | 精品久久亚洲 | 鲁一鲁资源影视 | 欧美色综合一区二区三区 | 免费黄色在线 | 午夜精品久久久久久久久久久久久 | 久久久久国产一区二区 | 日本午夜视频 | 欧美久久视频 | 成人久久18免费网站 | 日韩精品一区二区三区视频播放 | 久久精品综合网 | 中文字幕日韩欧美一区二区三区 | 国产一区二区电影网 | 日韩视频在线一区 | 日日噜噜噜夜夜爽爽狠狠视频, |