有一个在此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以哪种格式返回图像?
发布评论