首頁 後端開發 php教程 php-GD库函数(3)

php-GD库函数(3)

Jun 13, 2016 am 11:33 AM
image int

php-GD库函数(三)

<?php //imagefilledellipse — 画一椭圆并填充	/*bool imagefilledellipse ( resource $image , int $cx , int $cy , int $w , int $h , int $color )	$image:图片资源	$cx:左边离圆心的位置	$cy:上边离圆心的位置	$w:圆形的直径(左右方向)	$h:圆形的直径(上下方向)	$color:填充的颜色	$im = imagecreatetruecolor(100,100);	$red = imagecolorallocate($im,0,255,0);	imagefilledellipse($im,50,50,80,80,$red);	header('Content-type: image/png');	imagepng($im);	*/	//imagefilledpolygon — 画一多边形并填充	/*bool imagefilledpolygon ( resource $image , array $points , int $num_points , int $color )	$image:图片资源	$points:参数是一个按顺序包含有多边形各顶点的 x 和 y 坐标的数组	$num_points:参数是顶点的总数,必须大于 3	$color:颜色	$im = imagecreatetruecolor(200,200);	$value = array(	25,40,36,53,87,12,45,98,56,23);	$red = imagecolorallocate($im,255,0,0);	imagefilledpolygon($im,$value,5,$red);	header('Content-type: image/png');	imagepng($im);	*/	//imagefilledrectangle — 画一矩形并填充	/*bool imagefilledrectangle ( resource $image , int $x1 , int $y1 , int $x2 , int $y2 , int $color )	$image:图片资源	$x1:点到左边的距离	$y1:点到上边的距离	$x2:点到左边的距离	$y2:点到上边的距离	$color:填充的颜色	$im = imagecreatetruecolor(200,200);	$red = imagecolorallocate($im,255,0,0);	imagefilledrectangle($im,10,10,190,190,$red);	header('Content-type:image/png');	imagepng($im);	*/		//imagefontheight — 取得字体高度	/*$font_size = 1;	$a = imagefontheight($font_size);	echo $a;	*/	//imagefontwidth — 取得字体宽度	/*$font_size = 1;	$b = imagefontwidth($font_size);	echo $b;	*/		//imageline — 画一条线段	/*bool imageline ( resource $image , int $x1 , int $y1 , int $x2 , int $y2 , int $color )	$image:图片资源	$x1:点到左边的距离	$y1:点到上边的距离	$x2:点到左边的距离	$y2:点到上边的距离	$color:线段的颜色	$im = imagecreatetruecolor(200,200);	$red = imagecolorallocate($im,255,0,0);	imageline($im,10,10,100,100,$red);	header('Content-type:image/png');	imagepng($im);	*/		//imagepolygon — 画一个多边形	/*bool imagepolygon ( resource $image , array $points , int $num_points , int $color )	$image:图片资源	$points:参数是一个按顺序包含有多边形各顶点的 x 和 y 坐标的数组	$num_points:是顶点的总数。大于3	$color:线段的颜色	$im = imagecreatetruecolor(200,200);	$red = imagecolorallocate($im,255,0,0);	$value = array(13,45,23,56,23,45,78,99);	imagepolygon($im,$value,4,$red);	header('Content-type:image/png');	imagepng($im);	*/		//imagerectangle — 画一个矩形	/*bool imagerectangle ( resource $image , int $x1 , int $y1 , int $x2 , int $y2 , int $col )	$image:图片资源	$x1:点到左边的距离	$y1:点到上边的距离	$x2:点到左边的距离	$y2:点到上边的距离	$col:线段的颜色	$im = imagecreatetruecolor(200,200);	$red = imagecolorallocate($im,255,0,0);	imagerectangle($im,10,10,100,100,$red);	header('Content-type:image/png');	imagepng($im);	*/		//imagerotate — 用给定角度旋转图像	/*resource imagerotate ( resource $src_im , float $angle , int $bgd_color [, int $ignore_transparent ] )	$src_im:资源图片	$angle:旋转的度数	$bgd_color:背景颜色	$source = imagecreatefromjpeg('1.jpg');	$rotate = imagerotate($source,45, 26);	header('Content-type: image/jpeg');	imagejpeg($rotate); 	*/	//imagesetpixel — 画一个单一像素	/*bool imagesetpixel ( resource $image , int $x , int $y , int $color )	$image:图片资源	$x:点到左边的距离	$y:点到上边的距离	$color:点的颜色	$im = imagecreatetruecolor(100,100);	$red = imagecolorallocate($im,255,0,0);	imagesetpixel($im,50,50,$red);	header('Content-type: image/jpeg');	imagejpeg($im); 	*/	//imagesetstyle — 设定画线的风格	/*bool imagesetstyle ( resource $image , array $style )	$image:图片资源	$style:style 参数是像素组成的数组。下面的示例脚本在画布上从左上角到右下角画一行虚线: 	header("Content-type: image/jpeg");	$im  = imagecreatetruecolor(100, 100);	$w   = imagecolorallocate($im, 255, 255, 255);	$red = imagecolorallocate($im, 255, 0, 0);	$style = array($red, $red, $red, $red, $red, $w, $w, $w, $w, $w);	imagesetstyle($im,$style);	imageline($im, 0, 0, 100, 100, IMG_COLOR_STYLED);	imagejpeg($im);	imagedestroy($im);	*/	//imagestring — 水平地画一行字符串	/*bool imagestring ( resource $image , int $font , int $x , int $y , string $s , int $col )	$image:图片资源	$font:字体大小	$x:文字到左边的距离	$y:文字到上边的距离	$s:文字内容	$col:文字颜色	$im = imagecreatetruecolor(100,100);	$red = imagecolorallocate($im, 255, 0, 0);	imagestring($im,5,10,10,'helloworld',$red);	header("Content-type: image/jpeg");	imagejpeg($im);	imagedestroy($im);	*/	//imagestringup — 垂直地画一行字符串	/*bool imagestringup ( resource $image , int $font , int $x , int $y , string $s , int $col )	$image:图片资源	$font:字体大小	$x:文字到左边的距离	$y:文字到上边的距离	$s:文字内容	$col:文字颜色	$im = imagecreatetruecolor(100,100);	$red = imagecolorallocate($im, 255, 0, 0);	imagestringup ($im,5,20,90,'helloworld',$red);	header("Content-type: image/jpeg");	imagejpeg($im);	imagedestroy($im);	*/	//imagesx — 取得图像宽度	/*$im = imagecreatetruecolor(200,100);	echo imagesx($im);	*/	//imagesy — 取得图像长度	/*$im = imagecreatetruecolor(200,100);	echo imagesy($im);	*/	//imagegd2 — 将 GD2 图像输出到浏览器或文件	//imagegd — 将 GD 图像输出到浏览器或文件	//imagegif — 以 GIF 格式将图像输出到浏览器或文件	//imagejpeg — 以 JPEG 格式将图像输出到浏览器或文件	//imagepng — 以 PNG 格式将图像输出到浏览器或文件	//imagewbmp — 以 WBMP 格式将图像输出到浏览器或文件	//imagexbm — 将 XBM 图像输出到浏览器或文件	/*以上都是函数如果有第二个参数那么会保存到文件上,如果没有第二个参数则会输出到浏览器上*/	?>
登入後複製

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

<🎜>:泡泡膠模擬器無窮大 - 如何獲取和使用皇家鑰匙
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
Mandragora:巫婆樹的耳語 - 如何解鎖抓鉤
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
北端:融合系統,解釋
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

熱門話題

Java教學
1669
14
CakePHP 教程
1428
52
Laravel 教程
1329
25
PHP教程
1273
29
C# 教程
1256
24
PHP中int型別轉換為位元組的方法詳解 PHP中int型別轉換為位元組的方法詳解 Mar 06, 2024 pm 06:18 PM

PHP中int類型轉換為位元組的方法詳解在PHP中,我們經常需要將整數類型(int)轉換為位元組(Byte)類型,例如在處理網路資料傳輸、檔案處理或加密演算法等場景中。本文將詳細介紹如何將int類型轉換為位元組類型,以及提供具體的程式碼範例。 1.int型別與位元組的關係在電腦領域,基本資料型別int表示整數,而位元組(Byte)是電腦儲存單位,通常是8位元二進位數據

C++程式將double類型的變數轉換為int型別 C++程式將double類型的變數轉換為int型別 Aug 25, 2023 pm 08:25 PM

在C++中,int型別的變數只能保存正整數或負整數值;它們不能保存小數值。有float和double值可用於此目的。為了儲存小數點後最多七位的小數,創建了雙精度資料類型。整數到雙精確度資料類型的轉換可以由編譯器自動完成(稱為「隱式」轉換),也可以由程式設計師向編譯器明確要求(稱為「明確」轉換)。在接下來的部分中,我們將介紹各種轉換方法。隱式轉換編譯器會自動執行隱式類型轉換。要實現這一點,需要兩個變數——一個是浮點類型,另一個是整數類型。當我們簡單地將浮點值或變數分配給整數變數時,編譯器將處理所有其他事情

int32的取值範圍是多少 int32的取值範圍是多少 Aug 11, 2023 pm 02:53 PM

int32的取值範圍是從-2的31次方到2的31次方減1,即-2147483648到2147483647。 int32是有符號的整數型,表示它可以表示正數、負數和零,它使用1位來表示符號位,而剩餘的31位元用來表示數值。由於一位用來表示符號位,所以int32的有效位數是31位元。

如何免費使用Bing Image Creator 如何免費使用Bing Image Creator Feb 27, 2024 am 11:04 AM

本文將介紹七種利用免費的BingImageCreator獲得高品質輸出的方法。 BingImageCreator(現稱為MicrosoftDesigner的ImageCreator)是一個出色的線上人工智慧藝術生成器之一。它能根據使用者的提示產生高度逼真的視覺效果。提示越具體、清晰和創意,生成的效果也會更出色。 BingImageCreator在創建高品質影像方面取得了重大進展。現在它使用Dall-E3訓練模式,顯示出更高水準的細節和現實主義。然而,它能否始終如一地產生高清結果取決於幾個因素,包括快速

go語言怎麼將int轉為字串型 go語言怎麼將int轉為字串型 Jun 04, 2021 pm 03:56 PM

轉換方法:1、使用Itoa()函數,語法「strconv.Itoa(num)」;2、使用FormatInt()函數,可將int型資料轉換成指定進位並以字串的形式傳回,語法「strconv .FormatInt(num,10)」。

小米手機image怎麼刪除 小米手機image怎麼刪除 Mar 02, 2024 pm 05:34 PM

小米手機image怎麼刪除?在小米手機中是可以刪除image,但是多數的用戶不知道image如何的刪除,接下來就是小編為用戶帶來的小米手機image刪除方法教程,感興趣的用戶快來一起看看吧!小米手機image怎麼刪除1、先打開小米手機中的【相簿】功能;2、然後勾選不需要的圖片,點擊右下角的【刪除】按鈕;3、之後點擊最頂部的【相簿】進入到專區,選擇【回收站】;4、接著直接點選下圖所示的【清空回收站】;5、最後直接點選【永久刪除】即可完成。

java int 是幾位 java int 是幾位 Mar 06, 2023 pm 04:09 PM

在java中,int是32位元有符號資料類型,其變數需要32位元記憶體;int資料類型的有效範圍為-2147483648至2147483647,此範圍中的所有整數稱為整數面量。一個整數字面量可以分配給一個int變量,例如“int num1 = 21;”。

int佔幾個位元組 int佔幾個位元組 Jan 22, 2024 pm 03:14 PM

int型別在不同程式語言和不同硬體平台下所佔用的位元組數可能會有所不同。詳細介紹:1、在C語言中,int類型通常佔用2個位元組或4個位元組。在32位元系統中,int型別佔用4個位元組,而在16位元系統中,int型別佔用2個位元組。在64位元系統中,int型別可能佔用8個位元組;2、在Java中,int型別通常佔用4個位元組,而在Python中,int型別沒有位元組數限制,可以自動調整等等。

See all articles