PHP-related functions for file operations

Source: Internet
Author: User
Tags image identifier

1, fopen (): function Open file or URL. If open fails, this function returns FALSE.

2,fwrite (): Write file (can be used safely in binary file); fwrite (file,string,length)

3, A:fclose (): function closes an open file.

The B:unlink () function deletes the file. If successful, returns True, which returns false if it fails.

-----------------------

4,imagecreatefromjpeg (): Create a new image from a file or URL.

5, imagecreatetruecolor  (  int  $width  , int  $height  ) :   Create a new true color image; x_size   and   y_size   's black image.

6, imagecopyresampled ($dst _image, $src _image, int $dst _x, int $dst _y, int $src _x, int $src _y, in T $dst _w, int $dst _h, int $src _w, int $src _h): Picture synthesis (watermark)

$DST _image: New picture

$SRC _image: Images that need to be loaded

$DST _x: Sets the x-coordinate of the picture to be loaded in the new diagram

< Span class= "Hljs-keyword" >< Span class= "Hljs-keyword" >                  & nbsp $DST _y: Set the picture to be loaded in the new image y coordinates

< Span class= "Hljs-keyword" >< Span class= "Hljs-keyword" >                    $SRC _x: Set the area to load the image to load x coordinates

< Span class= "Hljs-keyword" >< Span class= "Hljs-keyword" >                     $SRC _y: Set the area y coordinates to be loaded into the image /span>

< Span class= "Hljs-keyword" >< Span class= "Hljs-keyword" >< Span class= "Hljs-keyword" >                    $DST _w: Sets the width of the loaded original image (zoom in this setting)

< Span class= "Hljs-keyword" >< Span class= "Hljs-keyword" >< Span class= "Hljs-keyword" >                    $DST _h: Set the height of the loaded artwork (zoom in this setting)

< Span class= "Hljs-keyword" >< Span class= "Hljs-keyword" >< Span class= "Hljs-keyword" >                    $SRC _w: The width of the original image to load

< Span class= "Hljs-keyword" >< Span class= "Hljs-keyword" >< Span class= "Hljs-keyword" >                    $SRC _h: The height of the original image to load

7. imagecreate (int x_size,int y_size): Create an all-empty graphic. The parameter x_size, Y_size is the size of the graph, in pixels (pixel).

8,imagecopyresized (int dst_im, int src_im, int dstX, int dsty, int srcx, int srcy, int dstw, int dsth, int srcw, int SrcH);

Copy the new diagram, and resize the picture again. Parameters are the purpose before, and the source is behind. The parameters Dst_im and Src_im are the handle of the picture. The parameters DstX, Dsty, SRCX, Srcy are the coordinates of the purpose and the source respectively. Parameters DSTW, Dsth, SRCW, SrcH respectively are the source and the purpose of the width and height, if you want to adjust the size of the new map is configured here.

9,imagejpeg (resource $image [, string $filename [, int $quality ]] ): Prints the image to the browser or file. image filename creates a JPEG image for the file name from the image.

10, Imagedestroy (): releases the memory associated with the image. Images are image identifiers returned by the image creation function, such as Imagecreatetruecolor ().

11.imagecreatefromstring (): creates a new image from the image stream in the string and returns an image identifier that expresses the image from the given string. The image format will be automatically detected, as long as PHP supports: Jpeg,png,gif,wbmp and GD2.

PHP-related functions for file operations

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.