Select platform: [Android](https://developers.google.com/maps/documentation/places/android-sdk/place-photos.md.txt "View this page for the Android platform docs.") [iOS](https://developers.google.com/maps/documentation/places/ios-sdk/place-photos.md.txt "View this page for the iOS platform docs.") [Web Service](https://developers.google.com/maps/documentation/places/web-service/place-photos.md.txt "View this page for the Web Service platform docs.")

<br />

**European Economic Area (EEA) developers**

> [!NOTE]
> 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](https://developers.google.com/maps/comms/eea/faq.md.txt).

<br />

> [!NOTE]
> This feature requires that you enable Places API (New), the next generation of the Places API. For more information, see [Enable APIs](https://developers.google.com/maps/documentation/places/ios-sdk/cloud-setup#enabling-apis).

<br />

You can use the Places SDK for iOS (New) to request place photos to
display in your application. Photos returned by the photos service come from a
variety of sources, including business owners and user-contributed photos.

Photos are bitmap images represented by a
[UIImage](https://developer.apple.com/documentation/uikit/uiimage) object.
A bitmap image has a maximum size of 4800 by 4800 pixels.

## Request an image

You can request up to 10 photos for a place:

1. Call
   [`[GMSPlacesClient lookUpPhotosForPlaceID]`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient.md.txt#-lookupphotosforplaceid:callback:),
   passing a place ID and a
   [`GMSPlacePhotoMetadataResultCallback`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions.md.txt#/c:GMSPlacesClient.h@T@GMSPlacePhotoMetadataResultCallback) callback.
   This request calls the `GMSPlacePhotoMetadataResultCallback` callback with a
   [`GMSPlacePhotoMetadataList`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacePhotoMetadataList)
   object.

2. From the `GMSPlacePhotoMetadataList` object in the callback, the
   [`results`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacePhotoMetadataList#results)
   array property contains the photos, where each photo is represented by a
   [`GMSPlacePhotoMetadata`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacePhotoMetadata.md.txt)
   object.

3. Use the `GMSPlacePhotoMetadata` object to create a
   [`GMSFetchPhotoRequest`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSFetchPhotoRequest.md.txt),
   including the maximum size of the requested image.

4. For each `GMSPlacePhotoMetadata` object in the array, call
   [`[GMSPlacesClient
   fetchPhotoWithRequest:callback:]`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient#-fetchphotowithrequest:callback:)
   passing the `GMSFetchPhotoRequest` object. This methods calls the
   [`GMSFetchPhotoResultCallback`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Type-Definitions.md.txt#/c:GMSPlacesClient.h@T@GMSFetchPhotoResultCallback)
   callback with a usable bitmap image as a UIImage.

Another way to request photos for a place is to make a
[Place Details (New)](https://developers.google.com/maps/documentation/places/ios-sdk/details-place.md.txt) request,
including `GMSPlacePropertyPhotos` in the field list. The advantage to making a
Place Details call is that the response
[`GMSPlace`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlace.md.txt)
object can contain the photos and any other data fields that you want for
the place.

> [!NOTE]
> **Note:** Whenever you display a place photo in your app, make sure to follow the attribution guidelines. See [Attributions](https://developers.google.com/maps/documentation/places/ios-sdk/place-photos.md.txt#attributions) for more information.

## Sample code

The following example method takes a place ID and gets the first photo in the
returned list. You can use this method as a template for the method you will
create in your own app.

### Places Swift SDK

```swift
// First fetch place details
// A hotel in Saigon with an attribution.
let placeID = "ChIJV4k8_9UodTERU5KXbkYpSYs"
let fetchPlaceRequest = FetchPlaceRequest(
  placeID: placeID,
  placeProperties: [ . name, .website ]
)
var fetchedPlace: Place
switch await placesClient.fetchPlace(with: fetchPlaceRequest) {
case .success(let place):
  fetchedPlace = place
case .failure(let placesError):
  // Handle error
}

// Use the place details to fetch a photo's image.
guard let photo = fetchedPlace.photos?.first else {
  // Handle place without photos.
}
let fetchPhotoRequest =
  FetchPhotoRequest(photo: photo, maxSize: CGSizeMake(4800, 4800))
switch await placesClient.fetchPhoto(with: fetchPhotoRequest) {
case .success(let uiImage):
  // Handle image.
case .failure(let placesError):
  // Handle error
}
```

### Swift

```swift
// A hotel in Saigon with an attribution.
let placeID = "ChIJV4k8_9UodTERU5KXbkYpSYs"

// Request list of photos for a place
placesClient.lookUpPhotos(forPlaceID: placeID) { (photos, error) in

  guard let photoMetadata: GMSPlacePhotoMetadata = photos?.results[0] else {
    return }

  // Request individual photos in the response list
  let fetchPhotoRequest = GMSFetchPhotoRequest(photoMetadata: photoMetadata, maxSize: CGSizeMake(4800, 4800))
  self.client.fetchPhoto(with: fetchPhotoRequest, callback: {
    (photoImage: UIImage?, error: Error?) in
      guard let photoImage, error == nil else {
        print("Handle photo error: ")
        return }
      print("Display photo Image: ")
    }
  )
}
```

### Objective-C

```objective-c
// A hotel in Saigon with an attribution.
NSString *placeID = @"ChIJV4k8_9UodTERU5KXbkYpSYs";

[placesClient lookUpPhotosForPlaceID:placeID callback: ^(GMSPlacePhotoMetadataList *list, NSError *error) {
  GMSPlacePhotoMetadata *photoMetadata = [list results][0];

  // Request individual photos in the response list
  GMSFetchPhotoRequest *fetchPhotoRequest = [[GMSFetchPhotoRequest alloc] initWithPhotoMetadata:photoMetadata maxSize:CGSizeMake(4800, 4800)];
  [placesClient fetchPhotoWithRequest:fetchPhotoRequest callback: ^(UIImage *_Nullable photoImage, NSError *_Nullable error) {
    if (error == nil) {
      // Display photo
    }
  }];
}];
```

## Caching

Photos loaded using [`[GMSPlacesClient loadPlacePhoto:callback:]`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient.md.txt#-loadplacephoto:callback:)
or [`[GMSPlacesClient loadPlacePhoto:constrainedToSize:scale:callback:]`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacesClient.md.txt#-loadplacephoto:constrainedtosize:scale:callback:)
are cached both on disk and in-memory by the [Foundation URL loading system](https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html)
in the shared [`NSURLCache`](https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSURLCache_Class/index.html).

To configure the caching behavior you can change the shared URL cache using
[`[NSURLCache setSharedURLCache:]`](https://developer.apple.com/library/ios/documentation/Cocoa/Reference/Foundation/Classes/NSURLCache_Class/index.html#//apple_ref/occ/clm/NSURLCache/setSharedURLCache:)
in your application delegate's `application:didFinishLaunchingWithOptions:`
method.

If you do not want your application to share a `NSURLCache` with the
Places SDK for iOS you can create a new `NSURLCache` and use this
exclusively within your app without setting it as the shared cache.

## Attributions

In most cases, place photos can be used without attribution, or will have the
required attribution included as part of the image. However, if the returned
[`GMSPlacePhotoMetadata`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacePhotoMetadata.md.txt)
instance includes any
[`attributions`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacePhotoMetadata.md.txt#attributions)
or
[`authorAttribution`](https://developers.google.com/maps/documentation/places/ios-sdk/reference/objc/Classes/GMSPlacePhotoMetadata.md.txt#authorattributions),
you must include these attributions in your application wherever you display the
image. See the documentation on
[attributions](https://developers.google.com/maps/documentation/places/ios-sdk/policies.md.txt#other_attribution_requirements).