Home >Backend Development >PHP Tutorial >php learning, 2016-5-10 2016 party members learning experience 2016 two sessions spirit learning experience 2016 two sessions spirit learning experience
1. bool function_exists (string $function_name)
Find function_name in the list of defined functions (including system-built-in functions and user-defined functions).
2. bool imagefilter ( resource
imagefilter() Apply the filter filtertype to the image, using arg1, arg2 and arg3 as needed.
This function is only available in PHP versions compiled with the GD library.
filtertype can be one of the following:
<code><span><?php</span><span>$im</span> = imagecreatefrompng(<span>'dave.png'</span>); <span>if</span> (<span>$im</span> && imagefilter(<span>$im</span>, IMG_FILTER_GRAYSCALE)) { <span>echo</span><span>'图片转化为灰度成功'</span>; imagepng(<span>$im</span>, <span>'dave.png'</span>); } <span>else</span> { <span>echo</span><span>'图片转化为灰度失败'</span>; } imagedestroy(<span>$im</span>); <span>?></span></code>
3.array getimagesize ( string $filename )
** This function contains an optional parameter, and official information is ignored because it is not commonly used
getimagesize() function will determine the size of any GIF, JPG, PNG, SWF, SWC, PSD, TIFF, BMP, IFF, JP2, JPX, JB2, JPC, XBM or WBMP image file and return the image dimensions and file type and a height/width text string that can be used in IMG tags in normal HTML files.
<code>print_r(getimagesize(<span>"web.jpg"</span>)); <span>/* 输出: Array ( [0] => 568 图像宽度的像素值 [1] => 2628 图像高度的像素值 [2] => 1 图像类型 [3] => width="568" height="2628" 图片长宽字符串 [bits] => 8 每种颜色的位数 [channels] => 3 对于 RGB 图像其值为 3,对于 CMYK 图像其值为 4 [mime] => image/gif 该图像的 MIME 类型 ) */</span></code>
Tags for image types: 1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order ), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF, 15 = WBMP, 16 = XBM.
4.resource imagecreatefromgd2 ( string $filename ) Create a new image from a GD2 file or URL
Questions left
imagecreatefromgd2()
If the fopen wrapper is enabled, in this function, the URL can be used as file name. See fopen() for details on how to specify a file name. For the different functions of various wappers, please refer to the supported protocols and encapsulation protocols, pay attention to their usage and the predefined variables they can provide.
The above introduces PHP learning, 2016-5-10, including PHP learning, 2016 content. I hope it will be helpful to friends who are interested in PHP tutorials.