doupapin172773 2011-09-14 02:57
浏览 172
已采纳

如何在PHP中将PNG转换为JPG?

I want read a google map url, convert the map to jpg & return the jpg map.

I suppose to have two markers in my map. however each time the map return to me only contains the first marker. Is there some characters that cannot be used thats why my url is cut short?

i.e.

<?php
$url = "http://maps.google.com/maps/api/staticmap?center=1.2993485,103.7875769&zoom=14&size=558x908&sensor=false&markers=color:blue|size:small|1.2993485,103.7875769&markers=color:blue|size:small|1.3050607723691974, 103.78171026706696";

$img = ImageCreateFromPng($url);

if($img) {
  header("Content-Type: image/jpeg");
  Imagejpeg($img);
  ImageDestroy($img);
} 
?>
  • 写回答

1条回答 默认 最新

  • dounabi6295 2011-09-14 02:59
    关注

    I am guessing that the space between 1.3050607723691974, 103.78171026706696 is not being properly escaped (and that it's probably a mistake).

    When you cut and paste the URL in your browser the space is probably being escaped with %20, which "corrects" the error.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?