Php 如何使用Google Places photo API返回的照片?

Php 如何使用Google Places photo API返回的照片?,php,image,google-places-api,laravel,Php,Image,Google Places Api,Laravel,我在我的Laravel PHP应用程序中调用Google Places Photo API: public static function getpic ($photoreference){ $app_id = 'XXXYYYZZZ'; $URLToCall = "https://maps.googleapis.com/maps/api/place/photo?maxwidth=225&photoreference=$photoreference&sensor=

我在我的Laravel PHP应用程序中调用
Google Places Photo API

public static function getpic ($photoreference){

    $app_id = 'XXXYYYZZZ';
    $URLToCall = "https://maps.googleapis.com/maps/api/place/photo?maxwidth=225&photoreference=$photoreference&sensor=false&key=$app_id";

    $result = file_get_contents($URLToCall);

    return $result;
}
当我打印$result时,我得到:

string(12902) "ÿØÿàJFIFÿá`ExifII*1&i‡.Picasa0220 á –ÿÛ„
我不知道如何使用退回的东西。我试图将字符串传递给视图,但失败了

有什么建议吗?

根据,回答是图像。这就解释了为什么打印它会产生二进制数据,就像你看到的那样

基本上,您需要保存这些数据,然后像在常规HTML中一样嵌入图像,或者只需将img src设置为指向$URLToCall