Place Photos(旧版)是 Places API 的一部分,是一个只读 API,可让您在自己的应用中添加高品质照片内容。借助地点照片(旧版),您可以访问存储在地点数据库中的数百万张照片。当您使用“地点详情”请求获取地点信息时,系统将返回相关照片内容的照片引用。“查找地点”(旧版)、“附近搜索”(旧版)和“文本搜索”(旧版)请求也会为每个地点返回一个照片引用(如果相关)。使用 Place Photos(旧版),您可以访问所引用的照片,并根据自己的应用将图片调整为最适合的大小。
A string identifier that uniquely identifies a photo. Photo references are
returned from either a Place Search or Place Details request.
maxheight or maxwidth
maxheight specifies the maximum desired height, in pixels, of the image. If the
image is smaller than the values specified, the original image will be
returned. If the image is larger in either dimension, it will be scaled to
match the smaller of the two dimensions, restricted to its original aspect
ratio.
maxwidth specifies the maximum desired width, in pixels, of the image. If the
image is smaller than the values specified, the original image will be returned.
If the image is larger in either dimension, it will be scaled to match the
smaller of the two dimensions, restricted to its original aspect ratio.
Both the maxheight and maxwidth properties
accept an integer between 1 and 1600.
You must specify either maxheight, or maxwidth, or both.
照片参考
对 Place Photos(旧版)的所有请求都必须包含 photo_reference,该 ID 在对“查找地点(旧版)”“附近搜索(旧版)”“文本搜索(旧版)”或“地点详情(旧版)”请求的响应中返回。如果地点有相关的照片内容,对这些请求的响应将包含 photos[] 字段。
[null,null,["最后更新时间 (UTC):2025-08-29。"],[],[],null,["# Place Photos (Legacy)\n\n**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq).\n**Note: Server-side\nand client-side libraries**\n\nThe Places API is also available with the\n[Java Client,\nPython Client, Go Client and Node.js Client for Google Maps Services](/maps/documentation/places/web-service/client-library).\nThe Places API and the client libraries are for\nuse in server applications.\n\nLooking to use this service in a JavaScript application? Take\na look at the\n[Places Library, Maps JavaScript API](/maps/documentation/javascript/places).\n\nPlace Photos (Legacy), part of the Places API, is a read-\nonly API that lets you add high quality photographic content to your\napplication. Place Photos (Legacy) gives you access to the millions of photos\nstored in the Places database. When you get place information using a Place\nDetails request, photo references will be returned for relevant photographic\ncontent. Find Place (Legacy), Nearby Search (Legacy), and Text Search (Legacy)\nrequests also return a single photo reference per place, when relevant. Using\nPlace Photos (Legacy) you can then access the referenced photos and resize the\nimage to the optimal size for your application.\n\nPlace Photos (Legacy) requests\n------------------------------\n\nA Place Photos (Legacy) request is an HTTP URL of the following form: \n\n```text\nhttps://maps.googleapis.com/maps/api/place/photo?parameters\n```\n\nCertain parameters are required to initiate a search request. As is standard\nin URLs, all parameters are separated using the ampersand (`&`) character. The\nlist of parameters and their possible values are enumerated below.\n\n\nRequired parameters\n-------------------\n\n-\n\n ### photo_reference\n\n\n A string identifier that uniquely identifies a photo. Photo references are\n returned from either a Place Search or Place Details request.\n-\n\n ### maxheight or maxwidth\n\n `maxheight` specifies the maximum desired height, in pixels, of the image. If the\n image is smaller than the values specified, the original image will be\n returned. If the image is larger in either dimension, it will be scaled to\n match the smaller of the two dimensions, restricted to its original aspect\n ratio.\n\n `maxwidth` specifies the maximum desired width, in pixels, of the image. If the\n image is smaller than the values specified, the original image will be returned.\n If the image is larger in either dimension, it will be scaled to match the\n smaller of the two dimensions, restricted to its original aspect ratio.\n\n\n Both the `maxheight` and `maxwidth` properties\n accept an integer between `1` and `1600`.\n\n\n You must specify either `maxheight`, or `maxwidth`, or both.\n\n\u003cbr /\u003e\n\nPhoto references\n----------------\n\nAll requests to Place Photos (Legacy) must include a `photo_reference`,\nreturned in the response to a Find Place (Legacy), Nearby Search (Legacy),\nText Search (Legacy), or Place Details (Legacy) request. The response to these\nrequests will contain a `photos[]` field if the place has related photographic\ncontent.\n\n**Note:** The number of photos returned varies by request.\n\n- A Find Place (Legacy), Nearby Search (Legacy), or Text Search (Legacy) request returns at most one `photo` element in the array.\n- A Place Details (Legacy) request returns up to ten `photo` elements.\n\nEach `photo` element contains the following fields:\n\n- `photo_reference` --- a string used to identify the photo when you perform a Place Photos (Legacy) request.\n- `height` --- the maximum height of the image.\n- `width` --- the maximum width of the image.\n- `html_attributions[]` --- contains any required attributions. This field will always be present, but may be empty.\n\nPhotos returned by Place Photos (Legacy) are sourced from a variety of locations,\nincluding business owners and user contributed photos. In most cases, these\nphotos can be used without attribution, or will have the required attribution\nincluded as a part of the image. However, if the returned `photo` element\nincludes a value in the `html_attributions` field, you must include the\nadditional attribution in your application wherever you display the image.\n| **Caution:** You cannot cache a `photo_reference`. Also, a `photo_reference` can expire. Ensure that you always get the `photo_reference` from the response to a request to [Place Details (Legacy)](/maps/documentation/places/web-service/details), [Find Place (Legacy)](/maps/documentation/places/web-service/search-find-place), [Nearby Search (Legacy)](/maps/documentation/places/web-service/search-nearby), or [Text Search (Legacy)](/maps/documentation/places/web-service/search-text). For more information, see the caching restrictions stated in Section 5.4 of the [Google Maps Platform Service Specific\n| Terms](https://cloud.google.com/maps-platform/terms/maps-service-terms)\n\nThe following example shows a Place Details (Legacy) request: \n\n```\ncurl \"https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJcUElzOzMQQwRLuV30nMUEUM&key=YOUR_API_KEY\"\n```\n\nAn example of the `photos[]` array in the response is shown below. \n\n ...\n \"photos\" : [\n {\n \"html_attributions\" : [],\n \"height\" : 853,\n \"width\" : 1280,\n \"photo_reference\" : \"ATJ83zhSSAtkh5LTozXMhBghqubeOxnZWUV2m7Hv2tQaIzKQJgvZk9yCaEjBW0r0Zx1oJ9RF1G7oeM34sQQMOv8s2zA0sgGBiyBgvdyMxeVByRgHUXmv-rkJ2wyvNv17jyTSySm_-_6R2B0v4eKX257HOxvXlx_TSwp2NrICKrZM2d5d2P4q\"\n }]\n ...\n\nPlace Photos (Legacy) example\n-----------------------------\n\nAn example request is shown below. This request returns the referenced\nimage, resizing it so that it is at most 400 pixels wide. \n\n```html\nhttps://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photo_reference=ATJ83zhSSAtkh5LTozXMhBghqubeOxnZWUV2m7Hv2tQaIzKQJgvZk9yCaEjBW0r0Zx1oJ9RF1G7oeM34sQQMOv8s2zA0sgGBiyBgvdyMxeVByRgHUXmv-rkJ2wyvNv17jyTSySm_-_6R2B0v4eKX257HOxvXlx_TSwp2NrICKrZM2d5d2P4q&key=YOUR_API_KEY\n```\n| **Note:** Replace the API key in this example with your own API key for the request to work in your application.\n\nPlace Photos (Legacy) response\n------------------------------\n\nThe response of a successful Place Photos (Legacy) request is an image. The type\nof the image depends upon the type of the originally submitted photo.\n\nIf your request exceeds your available quota, the server returns an\nHTTP 403 status and displays the below image to indicate that the quota has\nbeen exceeded:\n\nIf the server is unable to understand your request, then it returns HTTP 400\nstatus, which indicates an invalid request. The most common reasons for an\ninvalid request include:\n\n- The submitted photo reference was not correctly specified.\n- The request did not include either the `maxwidth` or the `maxheight` parameters.\n- The value for either the `maxwidth` or the `maxheight` parameter was set to `null`.\n- The `photo_reference` has expired. If `photo_reference` expires, make a request to [Place Details (Legacy)](/maps/documentation/places/web-service/details), [Find Place (Legacy)](/maps/documentation/places/web-service/search-find-place), [Nearby Search (Legacy)](/maps/documentation/places/web-service/search-nearby), or [Text Search (Legacy)](/maps/documentation/places/web-service/search-text) to get the updated `photo_reference` value."]]