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 图像输出到浏览器或文件	/*以上都是函数如果有第二个参数那么会保存到文件上,如果没有第二个参数则会输出到浏览器上*/	?>
Copy after login

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Detailed explanation of the method of converting int type to bytes in PHP Detailed explanation of the method of converting int type to bytes in PHP Mar 06, 2024 pm 06:18 PM

Detailed explanation of the method of converting int type to byte in PHP In PHP, we often need to convert the integer type (int) to the byte (Byte) type, such as when dealing with network data transmission, file processing, or encryption algorithms. This article will introduce in detail how to convert the int type to the byte type and provide specific code examples. 1. The relationship between int type and byte In the computer field, the basic data type int represents an integer, while byte (Byte) is a computer storage unit, usually 8-bit binary data

C++ program to convert double type variable to int type C++ program to convert double type variable to int type Aug 25, 2023 pm 08:25 PM

In C++, variables of type int can only hold positive or negative integer values; they cannot hold decimal values. There are float and double values ​​available for this purpose. The double data type was created to store decimals up to seven digits after the decimal point. Conversion of an integer to a double data type can be done automatically by the compiler (called an "implicit" conversion), or it can be explicitly requested by the programmer from the compiler (called an "explicit" conversion). In the following sections, we'll cover various conversion methods. Implicit conversions The compiler performs implicit type conversions automatically. To achieve this, two variables are required - one of floating point type and the other of integer type. When we simply assign a floating point value or variable to an integer variable, the compiler takes care of all the other things

How to use Bing Image Creator for free How to use Bing Image Creator for free Feb 27, 2024 am 11:04 AM

This article will introduce seven ways to get high-quality output using the free BingImageCreator. BingImageCreator (now known as ImageCreator for Microsoft Designer) is one of the great online artificial intelligence art generators. It generates highly realistic visual effects based on user prompts. The more specific, clear, and creative your prompts are, the better the results will be. BingImageCreator has made significant progress in creating high-quality images. It now uses Dall-E3 training mode, showing a higher level of detail and realism. However, its ability to consistently produce HD results depends on several factors, including fast

How to delete images from Xiaomi phones How to delete images from Xiaomi phones Mar 02, 2024 pm 05:34 PM

How to delete images on Xiaomi mobile phones? You can delete images on Xiaomi mobile phones, but most users don’t know how to delete images. Next is the tutorial on how to delete images on Xiaomi mobile phones brought by the editor. Interested users can come and join us. Let's see! How to delete images on Xiaomi mobile phone 1. First open the [Album] function in Xiaomi mobile phone; 2. Then check the unnecessary pictures and click the [Delete] button in the lower right corner; 3. Then click [Album] at the top to enter the special area , select [Recycle Bin]; 4. Then directly click [Empty Recycle Bin] as shown in the figure below; 5. Finally, directly click [Permanent Delete] to complete.

What is the value range of int32? What is the value range of int32? Aug 11, 2023 pm 02:53 PM

The value range of int32 is from -2 to the 31st power to 2 to the 31st power minus 1, that is, -2147483648 to 2147483647. int32 is a signed integer type, which means it can represent positive numbers, negative numbers, and zero. It uses 1 bit to represent the sign bit, and the remaining 31 bits are used to represent the numerical value. Since one bit is used to represent the sign bit, the effective number of int32 bits is 31.

How many numbers does java int have? How many numbers does java int have? Mar 06, 2023 pm 04:09 PM

In Java, int is a 32-bit signed data type, and its variables require 32-bit memory; the valid range of the int data type is -2147483648 to 2147483647, and all integers in this range are called integer literals. An integer literal can be assigned to an int variable, such as "int num1 = 21;".

How many bytes does int occupy? How many bytes does int occupy? Jan 22, 2024 pm 03:14 PM

The number of bytes occupied by the int type may vary in different programming languages ​​and different hardware platforms. Detailed introduction: 1. In C language, the int type usually occupies 2 bytes or 4 bytes. In 32-bit systems, the int type occupies 4 bytes, while in 16-bit systems, the int type occupies 2 bytes. In a 64-bit system, the int type may occupy 8 bytes; 2. In Java, the int type usually occupies 4 bytes, while in Python, the int type has no byte limit and can be automatically adjusted, etc.

Imagemagic installation Centos and Image installation tutorial Imagemagic installation Centos and Image installation tutorial Feb 12, 2024 pm 05:27 PM

LINUX is an open source operating system. Its flexibility and customizability make it the first choice of many developers and system administrators. In the LINUX system, image processing is a very important task, and Imagemagick and Image are Two very popular image processing tools, this article will introduce you to how to install Imagemagick and Image in Centos system, and provide detailed installation tutorials. Imagemagic installation Centos tutorial Imagemagick is a powerful image processing toolset, which can perform various image operations under the command line. The following are the steps to install Imagemagick on Centos system: 1

See all articles