Forum

Yampiz Forum

Sharing let knowledge Spreaded, Reading let spirits growth, Creative let culture extended, Let us
  • 禁止廣告文
  • 知識傳播
  • 閱讀
  • 心靈成長
  • 創作
  • 文化傳承
Dictionary / Programming / 網頁/網站程式 / PHP /

利用 PHP 產生網站縮圖

New Subject
Random
Previous
Next
|
    利用 PHP 產生網站縮圖

    ???php 5.2.2 開始支援了 imagegrabwindow 及 imagegrabscreen 兩個截圖函式,imagegrabscreen 用於截取整螢幕,imagegrabwindow 用於截取某個視窗(同ALT+PrintScreen)。

    imagegrabscreen用法:

    程式項目名稱
    1. /* 原始程式碼 */
    2. <?php
    3. $im = imagegrabscreen();
    4. imagepng($im, "gd_screen.png");
    5. ?>

    imagegrabwindow用法:

    程式項目名稱
    1. /* 原始程式碼 */
    2. <?php
    3. $ie = new COM("InternetExplorer.Application") or die("Can't start Internet Explorer");
    4. try {
    5. $handle = $ie->HWND;
    6. $ie->Visible = true;
    7. $ie->Navigate("http://www.php.net");
    8. while ($ie->Busy) {
    9. com_message_pump(4000);
    10. }
    11. } catch (com_exception $e) {
    12. echo $e;
    13. }
    14. $im = imagegrabwindow($handle, 0);
    15. imagepng($im, "gd_window.png");
    16. $ie->Quit();
    17. ?>

    注意!imagegrabwindow 這個截圖函式目前只支援 Windows 環境,Linux 下還不行,如果截圖只出現一張黑圖是因為沒有勾選選項:控制面板->管理工具->服務->你的apache服務->屬性->登陸->與桌面交互,選好了以後截圖代碼就可以正確運行了。

    • Keywords : imagegrabwindow, imagegrabscreen, 原始程式碼, imagepng, handle, 用於截取某, 用於截取整螢幕, 截圖只出現一, 截圖函式目前只, 以後截圖代碼就可以正確運行, while, start, gd_window, gd_screen, com_exception, catch, apache服務, Windows, Visible, PrintScreen
    00
    2010-04-16T11:43:00+0000


    • Now, you can post comments by Facebook Account when your Yampiz account was logout or unvariable. whatever, we suggest to post comment by Yampiz Account to get more bounds to join new events of Heyxu
    Comment
     
    Verify
    Comment
    • Auto Platform
      For better browsing experience, it will auto detects your device to display webpage.
    • Bug Report
      Tell us about the idea, problem and errors you found.
    • Comodo Secure
      The sensitive data transmission adopts by SSL-2048 authenticated encryption.
    • Copyright
      © 2009 YamPiz Digital Inc. & Jaby Group. All rights reserved.
    • Revised Version
      V2.2.552
      05 Dec 2025 (GMT+8)