duanbinren8906 2012-03-23 20:20
浏览 55

PHP GD Library无法显示图片

I have problem with PHP's GD Library..I've made this script for showing some users stats, and it can't work.I don't know why but it just shows broken picture..How can i fix it ?

Thanks, sorry for bad english

                     header("Content-type: image/png");

        $image      = imagecreatetruecolor(320, 180);

            $online_ico = imagecreatefrompng("/files/online.png");


            $avatar = imagecreatefrompng("/files/default.png");


        $white  = imagecolorallocate($image, 255, 240, 240);
        $green  = imagecolorallocate($image, 0, 255, 0);
        $red    = imagecolorallocate($image, 255, 0, 0);
        $blue   = imagecolorallocate($image, 9, 105, 162);

        $user_id = "25";
        imagefill($image, 0, 0, $blue); 

        //labels
        imagestring($image, 5, 20, 20, "ID ", $white);
        imagestring($image, 5, 20, 40, "UN", $white);
        imagestring($image, 5, 20, 60, "stats", $white);
        imagestring($image, 5, 20, 80, "name", $white);
        //data
        imagestring($image, 5, 130, 20, $user_id, $white);
        imagestring($image, 5, 150, 40, $user_id, $white);
        imagestring($image, 5, 130, 60, $user_id, $white);
        imagestring($image, 5, 130, 80, $user_id, $white);

        imagecopy($image, $online_ico, 130, 41, 0, 0, 16, 16);
        imagecopy($image, $avatar, 280, 140, 0, 0, 35, 35);

        imagepng($image);
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度