1 / 16

PHP5&MySQL 程式設計

PHP5&MySQL 程式設計. 第 10 章  GD 繪圖與影像處理. 10-1 GD 繪圖. <?php phpinfo(); ?>. 倘若沒有啟動 GD 圖形處理函式庫,請使用 UltraEdit 開啟 C:php5php.ini 組態檔,搜尋 “ ;extension=php_gd2.dll” 字串 ( 第 587 行 ) ,將前面的 ; 去掉並存檔,令這行敘述變成如下,即可使用 GD 圖形處理函式庫進行繪圖: extension=php_gd2.dll. 使用 GD 圖形處理函式庫進行繪圖的步驟如下: 建立空的圖片

luana
Télécharger la présentation

PHP5&MySQL 程式設計

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PHP5&MySQL程式設計 第 10 章 GD 繪圖與影像處理

  2. 10-1GD繪圖 <?php phpinfo(); ?>

  3. 倘若沒有啟動 GD 圖形處理函式庫,請使用 UltraEdit 開啟 C:\php5\php.ini組態檔,搜尋 “;extension=php_gd2.dll” 字串(第587行),將前面的; 去掉並存檔,令這行敘述變成如下,即可使用 GD 圖形處理函式庫進行繪圖: extension=php_gd2.dll

  4. 使用 GD 圖形處理函式庫進行繪圖的步驟如下: • 建立空的圖片 • 指派顏色 • 繪製線條、圖形或文字 • 輸出圖片 • 釋放記憶體

  5. 10-1-1 建立空的圖片 • imagecreate(int x_size, int y_size) • imagecreatetruecolor(int x_size, int y_size)

  6. 10-1-2 指派色彩 • imagecolorallocate(resource image, int red, int green, int blue)

  7. 10-1-3 繪製線條、圖形與文字 • 繪製橢圓形 imageellipse(resource image, int cx, int cy, int w, int h, int color) • 繪製直線 imageline(resource image, int x1, int y1, int x2, int y2, int color) • 繪製多邊形 imagepolygon(resource image, array points, int num_points, int color)

  8. 繪製矩形 imagerectangle(resource image, int x1, int y1, int x2, int y2, int col) • 繪製弧線 imagearc(resource image, int cx, int cy, int w, int h, int s, int e, int color) • 填滿色彩 imagefill(resource image, int x, int y, int color)

  9. 填滿橢圓形色彩 imagefilledellipse(resource image, int cx, int cy, int w, int h, int color) • 填滿多邊形色彩 imagefilledpolygon(resource image, array points, int num_points, int color) • 填滿矩形色彩 imagefilledrectangle(resource image, int x1, int y1, int x2, int y2, int color)

  10. 繪製橫向字元 imagechar(resource image, int font, int x, int y, string c, int color) • 繪製直向字元 imagecharup(resource image, int font, int x, int y, string c, int color) • 繪製橫向文字 imagestring(resource image, int font, int x, int y, string s, int col)

  11. 繪製直向文字 imagestringup(resource image, int font, int x, int y, string s, int col) • 繪製 TrueType 文字 imagettftext(resource image, float size, float angle, int x, int y, int color, string fontfile, string text)

  12. 10-1-4 輸出圖片 • GIF 格式 imagegif(resource image [, string filename]) • PNG 格式 imagepng(resource image [, string filename]) • JPG 格式 imagejpeg(resource image [, string filename [, int quality]])

  13. 10-1-5 釋放記憶體 imagedestroy(resource image)

  14. 10-2 實用的圖片函式 • 10-2-1 取得圖片格式 exif_imagetype(string filename) • 10-2-2 取得圖片大小 getimagesize(string filename) • 10-2-3 讀取圖片的 Exif 標頭資訊 exif_read_data(string filename) • 10-2-4 讀取內嵌在 Exif 標頭資訊中的縮圖 exif_thumbnail(string filename [, int &width [, int &height [, int &imagetype]]])

  15. 10-2-5 讀取外部圖片 imagecreatefromgif(string filename) imagecreatefromjpeg(string filename) imagecreatefrompng(string filename) • 10-2-6 製作圖片縮圖 imagecopyresized(resource dst_image, resource 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)

More Related