• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
    • 軟件測試技術
    • 軟件測試博客
    • 軟件測試視頻
    • 開源軟件測試技術
    • 軟件測試論壇
    • 軟件測試沙龍
    • 軟件測試資料下載
    • 軟件測試雜志
    • 軟件測試人才招聘
      暫時沒有公告

    字號: | 推薦給好友 上一篇 | 下一篇

    讓你的PHP同時支持GIF、png、JPEG

    發布: 2007-7-14 19:53 | 作者: 佚名    | 來源: 網絡轉載     | 查看: 12次 | 進入軟件測試論壇討論

    領測軟件測試網 在RedHat6.2按php的manual編譯安裝,發現只能處理GIF圖像,不能處理JPEG圖像。后來知道PHP處理圖像,使用了GD庫,而GD庫開始時是支持GIF的,但由于GIF使用了有版權爭議的LZW算法,會引起法律問題,于是從GD-1.6開始,GD庫不再支持GIF,改為支持更好的,無版權爭議的PNG。而我現在希望同時支持GIF,PNG和JPEG。

    1、 Jpeg6b的安裝
    RedHat6.2中已經有了RPM包,我們也就不需要去費勁編譯了。
        放入安裝盤
        mount /mnt/cdrom
        cd /mnt/cdrom/RedHat/RPMS
        rpm -ivh libjpeg*

    安裝成功,用rpm -ql libjpeg-6b-10 查看,發現libjpeg.so.62.0.0被拷到/usr/lib目錄下。記住此目錄,等會兒配php時要用。

    2、 GD-1.8.3的安裝
    獲取GD源碼的地址為:
    http://www.boutell.com/gd/
    你當然可以自己編譯,但它不支持jpeg,要打補丁。
    獲取補丁源碼的地址為:
    http://www.webofsin.com/gd-1.8.3-gif.patch
    接下來………………麻煩死了……勸你還是不要自己編譯了!

    有現成的東西為何不用呢?已經有人打好補丁編譯好了,做成RPM。
    可以在:
    http://rpms.arvin.dk/rh7-backports/gd/
    http://rpms.arvin.dk/gd-with_gif/
    得到。世上竟然有這么好的人?;-<
    真令人感動。!

    下載了幾個gd-with_gif*.rpm后直接 rpm -ivh gd-with_gif* 安裝。
    用 rpm -ql gd-with_gif-1.8.3-7 查看
    發現 libgd.so.1.8.3 放到了 /usr/gd-with_gif/lib 下
    記住此目錄,配php時也要用。

    3、 PHP的安裝和配置
    鑒于曾聽說php4.0不支持jpeg(不知記錯沒),我建議還是用php的最新版。
    下面的,大家應該熟悉得不能再熟悉了吧?
    于是我把php的manual抄下來:
    ---------------------------------
    1.  gunzip apache_1.3.x.tar.gz
    2.  tar xvf apache_1.3.x.tar
    3.  gunzip php-x.x.x.tar.gz
    4.  tar xvf php-x.x.x.tar
    5.  cd apache_1.3.x
    6.  ./configure --prefix=/www
    7.  cd ../php-x.x.x
    8.  這里是關鍵。!
        ./configure --with-mysql --with-apache=../apache_1.3.x --enable-track-vars --with-jpeg-dir=/usr/lib --with-gd=/usr/gd-with_gif/lib
        當然你也可以加上你自己的選項,此不贅述。
    9.  make
    10. make install
    11. cd ../apache_1.3.x
    12. for PHP 4: ./configure --activate-module=src/modules/php4/libphp4.a
    13. make
    14. make install

      Instead of this step you may prefer to simply copy the httpd binary
      overtop of your existing binary.  Make sure you shut down your
      server first though.

    15. cd ../php-x.x.x
    16. for PHP 4: cp php.ini-dist /usr/local/lib/php.ini

      You can edit your .ini file to set PHP options.  If
      you prefer this file in another location, use
      --with-config-file-path=/path in step 8.

    17. Edit your httpd.conf or srm.conf file and add:
         For PHP 4:   AddType application/x-httpd-php .php

      You can choose any extension you wish here.  .php is simply the one
      we suggest. You can even include .html .


    18. Use your normal procedure for starting the Apache server. (You must
        stop and restart the server, not just cause the server to reload by
        use a HUP or USR1 signal.)
    ---------------------------------------
          
    終于成功了,你可以啟動apache用phpinfo()試一試,發現gd那里:
    ----------------------
            gd
    GD Support enabled
    GD Version 1.6.2 or higher
    GIF Support enabled
    PNG Support enabled
    JPG Support enabled
    WBMP Support enabled
    ----------------------

    ^_^哈哈哈哈哈哈哈哈哈^_^
    你現在可以用到所有的php圖形函數了:
    ImageCreateFromGIF() — Create a new image from file or URL
    ImageCreateFromJPEG() — Create a new image from file or URL
    ImageCreateFromPNG() — Create a new image from file or URL
    ……
    絕對沒問題。。!

    文章來源于領測軟件測試網 http://www.kjueaiud.com/


    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
    北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備10010545號-5
    技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

    軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>