Google Places Photos API以哪种格式返回图像?

编程入门 行业动态 更新时间:2024-10-22 20:40:45
本文介绍了Google Places Photos API以哪种格式返回图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有一个在此API: maps.googleapis/maps/api/place/photo?maxwidth=400&photoreference=CnRtAAAATLZNl354RwP_9UKbQ_5Psy40texXePv4oAlgP4qNEkdIrkyse7rPXYGd9D_Uj1rVsQdWT4oRz4QrYAJNpFX7rzqqMlZw2h2E2y5IKMUZ7ouD_SlcHxYq1yL4KbKUv3qtWgTK0A6QbGh87GB3sscrHRIQiG2RrmU_jF4tENr9wGS_YxoUSSDrYjWmrNfeEHSGSc3FyhNLlBU&key=AddYourOwnKeyHere

当您使用Postman或在浏览器中调用它时,它会返回精美呈现的图像.现在,从应用程序内部,当我使用$ http或jQuery调用此API时,返回的是很多垃圾".谁能解释这个垃圾是什么?它是与图像相对应的base64编码的二进制数据吗? 我需要这些信息,以便可以在我的应用中显示该图像. img ng-src ="{{photo}}"和img data-ng-src =" {{photo}}"均无效.我还尝试在img标签中显式指定base64,这没用.

When you invoke it using Postman, or in a browser, it returns an image which is rendered beautifully. Now, from inside an app, when I use $http or jQuery to call this API, what is returned is LOTS of "garbage". Can anyone explain what this garbage is? Is it base64 encoded binary data corresponding to the image? I need this information so that I can display this image in my app.. Neither img ng-src="{{photo}}" nor img data-ng-src="{{photo}}" worked. I also tried explicitly specifying base64 in the img tag, didn't work.

谢谢!

推荐答案

该URL返回图像的二进制文件,例如JPEG文件.您可以将该URL直接用作<img>标记的src.

That URL returns the binary file of the image, e.g. a JPEG file. You can use that URL as the src of an <img> tag directly.

更多推荐

Google Places Photos API以哪种格式返回图像?

本文发布于:2023-11-26 13:05:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1633981.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:哪种   图像   格式   Places   Google

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!