php 對檔案操作相關函數

來源:互聯網
上載者:User

標籤:

1、fopen() :函數開啟檔案或者 URL。如果開啟失敗,本函數返回 FALSE。

2、fwrite() : 寫入檔案(可安全用於二進位檔案);fwrite(file,string,length)

3、a: fclose() :函數關閉一個開啟檔案。

   b: unlink() 函數刪除檔案。若成功,則返回 true,失敗則返回 false。

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

4、imagecreatefromjpeg() : 由檔案或 URL 建立一個新圖象。

5、imagecreatetruecolor ( int $width , int $height ) : 建立一個真彩色映像;返回一個映像標識符,代表了一幅大小為 x_size 和 y_size 的黑色映像。

6、imagecopyresampled ($dst_image , $src_image , int $dst_x , int $dst_y , int $src_x , int $src_y , int $dst_w , int $dst_h , int $src_w , int $src_h ):圖片合成(加浮水印)

                    $dst_image:建立的圖片

                    $src_image:需要載入的圖片

                    $dst_x:設定需要載入的圖片在新圖中的x座標

                    $dst_y:設定需要載入的圖片在新圖中的y座標

                    $src_x:設定載入圖片要載入的地區x座標

                    $src_y:設定載入圖片要載入的地區y座標

                    $dst_w:設定載入的原圖的寬度(在此設定縮放)

                    $dst_h:設定載入的原圖的高度(在此設定縮放)

                    $src_w:原圖要載入的寬度

                    $src_h:原圖要載入的高度

7、imagecreate(int x_size,int y_size) :建立一張全空的圖形。參數 x_size、y_size 為圖形的尺寸,單位為像素 (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);

  複製新圖,並重新調整圖片的大小尺寸。參數都是目的在前,來源在後。參數 dst_im 及 src_im 為圖片的 handle。參數 dstX、dstY、srcX、srcY 分別為目的及來源的座標。參數 dstW、dstH、srcW、srcH 分別為來源及目的的寬及高,若欲調整新圖的尺寸就在這兒配置。

9、imagejpeg(resource $image [, string $filename [, int $quality ]] ) : 輸出圖象到瀏覽器或檔案。從 image 映像以 filename 為檔案名稱建立一個 JPEG 映像。

10、imagedestroy() : 釋放與 image關聯的記憶體。image是由映像建立函數返回的映像標識符,例如 imagecreatetruecolor().

11、imagecreatefromstring() : 從字串中的映像流建立一映像,返回一個映像標識符,其表達了從給定字串得來的映像。映像格式將自動檢測,只要 PHP 支援:JPEG,PNG,GIF,WBMP 和 GD2。

 

php 對檔案操作相關函數

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.