开发者

how do i convert PNG to JPG in PHP?

开发者 https://www.devze.com 2023-04-04 12:42 出处:网络
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

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=558x9开发者_StackOverflow社区08&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);
} 
?>


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消