Place Photos (舊版) 是 Places API 的一部分,屬於唯讀 API,可讓您在應用程式中加入高品質的相片內容。您可以透過「地點相片」(舊版) 存取數百萬張儲存在地點資料庫中的相片。使用 Place Details 要求取得地點資訊時,系統會傳回相片參照,提供您相關的影像內容。此外,Find Place (舊版)、Nearby Search (舊版) 和 Text Search (舊版) 要求也會視情況傳回每個地點的單一相片參照。之後,您可以使用「地點相片 (舊版)」存取參照的相片,並配合應用程式將圖片調整至最佳尺寸。
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,這項資訊會在 Find Place (舊版)、Nearby Search (舊版)、Text Search (舊版) 或 Place Details (舊版) 要求的回應中傳回。如果地點有相關的相片內容,這些要求的回應會包含 photos[] 欄位。
注意:系統傳回的相片數量會因要求而異。
Find Place (舊版)、Nearby Search (舊版) 或 Text Search (舊版) 要求最多會在陣列中傳回一個 photo 元素。
Place Details (舊版) 要求最多會傳回十個 photo 元素。
每個 photo 元素都包含下列欄位:
photo_reference:執行 Place Photos (舊版) 要求時,用來識別相片的字串。
height:圖片的最大高度。
width:圖片寬度上限。
html_attributions[]:包含所有必要出處標示。這個欄位一律會顯示,但可能為空。
Place Photos (Legacy) 傳回的相片取自各種地點,包括業主和使用者提供的相片。在大多數情況下,使用這些相片時可以不包含作者資訊,圖片本身也可能已加入必要的作者資訊。不過,如果傳回的 photo 元素在 html_attributions 欄位中包含值,您每次顯示圖片時就必須在應用程式中另外加入作者資訊。
[null,null,["上次更新時間: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."]]