[請益] php 抓圖

看板PHP作者 (Google.net)時間14年前 (2011/11/23 16:37), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/1
這是一個測試頁面 我想從google chart上把產生的報表圖片 自動抓取下來 放置指定的位置 但似乎一直無法成功 希望有大大指點我一下 哪裡該需要修改 <form method="post" action=""> <input type="text" name="str"><br/> <input type="text" name="wid"> x <input type="text" name="hei">g<br/> <input type="submit"> </form> <?php $width=$_POST["wid"]; $height=$_POST["hei"]; $info=$_POST["str"]; $url="<img src=\"https://chart.googleapis.com/chart?chs=" . $width . "x" . $height . "&cht=qr&chl=" . $info ."&choe=UTF-8\">"; function GrabImage($url, $filename=""){ if($url == ""){return false;} $ext = strrchr($url, "."); if($ext != ".png" && $ext != ".jpg" && $ext != ".gif"){echo "格式不對";return false;} if($filename == ""){$filename = time()."$ext";} ob_start(); readfile($url); $img = ob_get_contents(); ob_end_clean(); $size = strlen($img); $fp2 = fopen($filename , "a"); fwrite($fp2, $img); fclose($fp2); return $filename; } GrabImage("","as.png"); echo $url ; ?> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.118.16.146

11/23 22:57, , 1F
GrabImage("","as.png"); <--
11/23 22:57, 1F
文章代碼(AID): #1EpB3UIW (PHP)
文章代碼(AID): #1EpB3UIW (PHP)