PHP learning, 2016-5-10 2016 party members learning experience 20,162 will be spiritual learning 20,162 will be spiritual learning heart

Source: Internet
Author: User
1. BOOL Function_exists (string $function _name)

Find function_name in the list of functions already defined, including the system's own functions and user-defined functions.

    • Returns: Returns True if a function has already been defined
    • Returns false for queries of the syntax structure

2.bool ImageFilter (Resource srCim, I N T FilterType [, int arg1[,in t arg2 [, int $arg 3]]]) use filters on images php5,7

ImageFilter () applies the filter FilterType to the image and uses ARG1,ARG2 and arg3 when needed.
This function is only available in PHP versions that are bundled with the GD library.

    • FilterType can be one of the following:

      • Img_filter_negate: Reverses all colors in the image.
      • Img_filter_grayscale: Converts an image to grayscale.
      • Img_filter_brightness: Changes the brightness of the image. Set the brightness level with arg1.
      • Img_filter_contrast: Changes the contrast of the image. Set the contrast level with arg1.
      • Img_filter_colorize: Similar to Img_filter_grayscale, but you can specify a color. Use ARG1,ARG2 and Arg3 to designate Red,blue and green respectively. Each color range is 0 to 255.
      • Img_filter_edgedetect: Use edge detection to highlight the edges of the image.
      • Img_filter_emboss: Emboss the image.
      • Img_filter_gaussian_blur: Blur an image with a Gaussian algorithm.
      • Img_filter_selective_blur: Blur image.
      • Img_filter_mean_removal: Use the mean shift division to achieve the contour effect.
      • Img_filter_smooth: Make the image smoother. Set the smoothness level with arg1.

   
    $im = imagecreatefrompng('dave.png');if ($im && imagefilter($im, IMG_FILTER_GRAYSCALE)) {   echo'图片转化为灰度成功';   imagepng($im, 'dave.png');} else {   echo'图片转化为灰度失败';}imagedestroy($im);?>
    • If the format of the Imagecreatefrompng () function and the actual picture does not match when the original format does not match, this is not the changed extension
    • If you do not match the error prompt: gd-jpeg:jpeg Library reports unrecoverable error
    • Query the information of an image getimagesize ()

3.array getimagesize (String $filename)

* * This function contains an optional parameter because it is not used so it ignores the official information

The getimagesize () function will determine any GIF,JPG,PNG,SWF,SWC,PSD,TIFF,BMP,IFF,JP2,JPX,JB2,JPC,XBM or WBMP The size of the image file and returns the size of the image as well as the file type and a height/width text string that can be used in an IMG tag in an ordinary HTML file.

print_r(getimagesize("web.jpg"));/*输出:Array(    [0] => 568 图像宽度的像素值    [1] => 2628 图像高度的像素值    [2] => 1 图像类型      [3] => width="568" height="2628"  图片长宽字符串    [bits] => 8 每种颜色的位数    [channels] => 3 对于 RGB 图像其值为 3,对于 CMYK 图像其值为 4    [mime] => image/gif 该图像的 MIME 类型)*/

tag of the image type: 1 = gif,2 = jpg,3 = png,4 = swf,5 = psd,6 = bmp,7 = TIFF (Intel byte order), 8 = TIFF (Motorola byte order), 9 = jpc,1 0 = 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

Problem left

    1. IMAGECREATEFROMGD2 ()

      If the fopen wrapper is enabled, in this function, the URL can be used as the file name. For more information on how to specify filenames see fopen (). Different features of various wapper see supported protocols and encapsulation protocols, and note their usage and the predefined variables available.

      • URL meaning is not can choose a non-GD2 format picture, but I tried not

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above on the introduction of PHP learning, 2016-5-10, including PHP learning, 2016 aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.