बेहतर चीज़ें जोड़ें

जानकारी बेहतर होने की सुविधा की मदद से आपका ऐप्लिकेशन, Google Photos में किसी एल्बम में मौजूद फ़ोटो के स्ट्रक्चर और प्रज़ेंटेशन को कंट्रोल कर सकता है. इनकी मदद से, उपयोगकर्ता को टेक्स्ट या जगह की जानकारी के ज़रिए ज़्यादा जानकारी दी जा सकती है. साथ ही, साथ मिलकर सही कहानी बताने वाले ऑर्डर/ग्रुप इमेज भी दिखाई जा सकती हैं.

अनुमति देने का ज़रूरी दायरा

बेहतर सुविधाएं जोड़ने के लिए, इनमें से कम से कम एक स्कोप ज़रूरी है:

  • photoslibrary.appendonly
  • photoslibrary.library
  • photoslibrary.sharing

हर दायरे के लिए, enrichAlbum कॉल सिर्फ़ ऐप्लिकेशन से बनाए गए एल्बम तक सीमित है.

.sharing दायरे का इस्तेमाल करने पर, enrichAlbum उन मामलों में लागू होता है जहां डेवलपर, शेयर किए गए एल्बम के मालिक की ओर से कार्रवाई कर रहा हो.

जानकारी के टाइप

Google Photos, एल्बम में तीन तरह की बेहतर सुविधाएं देता है: टेक्स्ट, जगह की जानकारी, और मैप.

टेक्स्ट को बेहतर बनाने की सुविधा

टेक्स्ट को बेहतर बनाने की सुविधा एक सामान्य टेक्स्ट वाली स्ट्रिंग होती है. इसे एल्बम के बारे में बताने के लिए डाला जा सकता है.

Google Photos में दिखाए गए टेक्स्ट को बेहतर बनाने की सुविधा का स्क्रीनशॉट

जगह की जानकारी को बेहतर बनाना

जगह को बेहतर बनाने की सुविधा एक मार्कर और उस जगह का नाम होता है जिसे किसी जगह की जानकारी देने के लिए डाला जा सकता है.

Google Photos में दिखाए गए, जगह की जानकारी को बेहतर बनाने की सुविधा का स्क्रीनशॉट

मैप को बेहतर बनाने की सुविधा

मैप को बेहतर बनाने की सुविधा, एक ऐसा मैप होता है जिसमें शुरुआत और मंज़िल की जानकारी होती है और जिसे एल्बम में शामिल किया जा सकता है.

Google Photos में दिखाए गए मैप को बेहतर बनाने की सुविधा का स्क्रीनशॉट

गड़बड़ी की जगह

मीडिया आइटम और एल्बम को बेहतर बनाने की सुविधा जोड़ने के लिए, एल्बम की जगह बताएं. मीडिया आइटम के लिए जगह की जानकारी देना ज़रूरी नहीं होता, लेकिन एल्बम को बेहतर बनाने के लिए जगह तय होनी चाहिए.

मीडिया आइटम बनाते समय या कॉन्टेंट जोड़ते समय ही, जगह की जानकारी दी जा सकती है. किसी एल्बम में मौजूदा मीडिया आइटम फिर से व्यवस्थित नहीं किए जा सकते, इसलिए किसी आइटम को जोड़ते समय उसकी स्थिति सेट करना ज़रूरी है.

एल्बम का आरंभ

किसी मीडिया/जानकारी को बेहतर बनाने वाले आइटम को एल्बम की शुरुआत में सटीक स्थिति के तौर पर जोड़ा जा सकता है.

एल्बम का आखिरी हिस्सा

किसी मीडिया/जानकारी को बेहतर बनाने वाले आइटम को एल्बम के आखिर में, सटीक पोज़िशन के तौर पर जोड़ा जा सकता है.

मीडिया आइटम के सापेक्ष

एल्बम में किसी मीडिया आइटम की जगह के बाद से शुरू होने वाले मीडिया आइटम के हिसाब से, मीडिया/जानकारी को बेहतर बनाने वाले आइटम जोड़े जा सकते हैं.

बेहतर बनाने वाले आइटम के सापेक्ष

एल्बम में उसकी स्थिति के बाद से शुरू होने पर, किसी मीडिया/जानकारी को बेहतर बनाने वाले आइटम को जोड़ा जा सकता है.

एल्बम में एन्हैंसमेंट जोड़े जा रहे हैं

एक बार में एक ही जानकारी जोड़ी जाती है और उसे एल्बम में एक खास पोज़िशन में जोड़ा जाना चाहिए. किसी एल्बम में बेहतर चीज़ें जोड़ने के लिए, albums.addEnrichment पर कॉल करें.

अनुरोध पूरा होने पर, यह कॉन्टेंट को बेहतर बनाने वाले आइटम का id दिखाता है. इसका इस्तेमाल मीडिया आइटम या दूसरी सुविधाओं की पोज़िशन तय करने के लिए किया जा सकता है.

आराम

यहां एक पोस्ट अनुरोध दिया गया है:

POST https://photoslibrary.googleapis.com/v1/albums/album-id:addEnrichment
Content-type: application/json
Authorization: Bearer oauth2-token
request-body

अनुरोध के मुख्य हिस्से में जानकारी देने वाला आइटम और उसकी पोज़िशन शामिल होती है:

{
  "newEnrichmentItem": {
    enrichment-to-be-added
  },
  "albumPosition": {
    position-of-enrichment
}

यहां जवाब का एक नमूना दिया गया है:

{
  "enrichmentItem": {
    "id": "enrichment-item-id",
  }
}

Java

try {
  // Create the enrichment using the NewEnrichmentItemFactory helper
  NewEnrichmentItem newEnrichmentItem = NewEnrichmentItemFactory.createTextEnrichment("");

  // Set the position of the enrichment within the album
  AlbumPosition albumPosition = AlbumPositionFactory.createFirstInAlbum();

  // To add an enrichment, specify the album, the enrichment item,
  // and the position in the album where the enrichment is to be added
  AddEnrichmentToAlbumResponse response = photosLibraryClient
      .addEnrichmentToAlbum(albumId, newEnrichmentItem, albumPosition);
  // The response contains an EnrichmentItem
  // whose ID can be used to position media items or other enrichments
  EnrichmentItem enrichmentItem = response.getEnrichmentItem();
  String itemId = enrichmentItem.getId();
} catch (ApiException e) {
  // Handle error
}

PHP

// Create the enrichment item using the PhotosLibraryResourceFactory helper
$newEnrichmentItem = PhotosLibraryResourceFactory::newEnrichmentItemWithText("");
// ...
// Set the position of the enrichment within the album
$position = new AlbumPosition();
// ...
try {
    // To add an enrichment, specify the album, the enrichment item,
    // and the position in the album where the enrichment is to be added
    $response = $photosLibraryClient->addEnrichmentToAlbum($albumId, $newEnrichmentItem, $position);
    // The response contains an EnrichmentItem
    // whose ID can be used to position media items or other enrichments
    $enrichmentItem = $response->getEnrichmentItem();
    $itemId = $enrichmentItem->getId();

} catch (\Google\ApiCore\ApiException $e) {
    // Handle error
}

काम करने वाली सुविधाएं

टेक्स्ट को बेहतर बनाने की सुविधा

टेक्स्ट एन्हैंसमेंट में एक टेक्स्ट स्ट्रिंग (1,000 से ज़्यादा वर्ण नहीं) होती हैं, जैसा कि इस उदाहरण में दिखाया गया है:

आराम

{
  "text": "Text to be shown"
}

Java

// Use the NewEnrichmentItemFactory helper to create a text enrichment item
NewEnrichmentItem newEnrichmentItem =
    NewEnrichmentItemFactory.createTextEnrichment("text to be shown");

PHP

$newEnrichmentItem = PhotosLibraryResourceFactory::newEnrichmentItemWithText("text to be shown");

जगह की जानकारी को बेहतर बनाना

जगह के जानकारी को बेहतर बनाने में जगह का मनचाहे नाम के साथ-साथ अक्षांश और देशांतर की स्थिति भी शामिल होती है. locationName में ज़्यादा से ज़्यादा 500 वर्ण हो सकते हैं.

आराम

{
  "location": {
    "locationName": "Australia",
    "latlng": {
      "latitude": "-21.197",
      "longitude": "95.821"
    }
  }
}

Java

// Use the NewEnrichmentItemFactory helper to create a location enrichment
// with the name, latitude, and longitude of the location
NewEnrichmentItem newEnrichmentItem =
    NewEnrichmentItemFactory.createLocationEnrichment("Australia", -21.197, 95.821);

PHP

// Create a new location object and set the name, latitude, and longitude of the location
$newLocation = new Location();
$newLocation->setLocationName("Australia");
$newLocation->setLatlng((new LatLng())->setLatitude(-21.197)->setLongitude(95.821));

$newEnrichmentItem = PhotosLibraryResourceFactory::newEnrichmentItemWithLocation($newLocation);

मैप को बेहतर बनाने की सुविधा

मैप में दो जगहें दिखती हैं, जिनमें से हर जगह का नाम, अक्षांश और देशांतर होता है. जगह को बेहतर बनाने की तरह ही, ऑरिजिन और destination में मौजूद locationName में ज़्यादा से ज़्यादा 500 वर्ण हो सकते हैं.

आराम

{
  "origin": {
    "locationName": "Australia",
    "latlng": {
      "latitude": "-21.197",
      "longitude": "95.821"
    }
  },
  "destination": {
    "locationName": "San Francisco",
    "latlng": {
      "latitude": "37.757",
      "longitude": "122.507"
    }
  }
}

Java

// Use the NewEnrichmentItemFactory helper to create a map enrichment item for
// an origin and a destination location
NewEnrichmentItem newEnrichmentItem = NewEnrichmentItemFactory.createMapEnrichment(
    "Australia", -21.197, 95.821, // origin
    "San Francisco", 37.757, 122.507 // destination
);

PHP

// Create two new location objects to create a map enrichment item
// for an origin and a destination location
$locationAustralia = new Location();
$locationAustralia->setLocationName("Australia");
$locationAustralia->setLatlng((new LatLng())->setLatitude(-21.197)->setLongitude(95.821));

$locationSanFrancisco = new Location();
$locationSanFrancisco->setLocationName("San Francisco");
$locationSanFrancisco->setLatlng((new LatLng())->setLatitude(37.757)->setLongitude(122.507));

$newEnrichmentItem =
  PhotosLibraryResourceFactory::newEnrichmentItemWithMap($locationAustralia, $locationSanFrancisco);

इस्तेमाल की जा सकने वाली पोज़िशनिंग

एल्बम का आरंभ

FIRST_IN_ALBUM स्थिति से एल्बम की शुरुआत का पता चलता है. यहां मौजूद आइटम, सबसे पहले उपयोगकर्ता को दिखाए जाते हैं:

आराम

{
  "position": "FIRST_IN_ALBUM",
}

Java

AlbumPosition albumPosition = AlbumPositionFactory.createFirstInAlbum();

PHP

$albumPosition = new AlbumPosition();
$albumPosition->setPosition(PositionType::FIRST_IN_ALBUM);

एल्बम का आखिरी हिस्सा

LAST_IN_ALBUM स्थिति एल्बम का अंत बताती है. यहां मौजूद आइटम, उपयोगकर्ता को सबसे आखिर में दिखाए जाते हैं.

आराम

{
  "position": "LAST_IN_ALBUM",
}

Java

AlbumPosition albumPosition = AlbumPositionFactory.createLastInAlbum();

PHP

$albumPosition = new AlbumPosition();
$albumPosition->setPosition(PositionType::LAST_IN_ALBUM);

मीडिया आइटम के सापेक्ष

जगह relativeMediaItem तय करने से मीडिया आइटम के मिलते-जुलते क्रम का पता चलता है. आइटम को, दिए गए मीडिया आइटम के बाद जोड़ा जाता है.

आराम

{
  "position": "after-media-item",
  "relativeMediaItemId": "media-item-id"
}

Java

AlbumPosition albumPosition = AlbumPositionFactory.createAfterMediaItem(mediaItemId);

PHP

$albumPosition = PhotosLibraryResourceFactory::albumPositionAfterMediaItem($mediaItemId);

बेहतर बनाने वाले आइटम के सापेक्ष

relativeEnrichmentItemId तय करना, किसी बेहतर बनाए गए आइटम के मुकाबले उसकी रैंक बताता है. आइटम, बताए गए बेहतर बनाने वाले आइटम के बाद जोड़े जाते हैं.

आराम

{
  "position": "after-enrichment-item",
  "relativeEnrichmentItemId": "enrichment-item-id"
}

Java

AlbumPosition albumPosition = AlbumPositionFactory.createAfterEnrichmentItem(enrichmentItemId);

PHP

$albumPosition = PhotosLibraryResourceFactory::albumPositionAfterEnrichmentItem($enrichmentItemId);

बेहतर बनाने के तरीकों में बदलाव करना

फ़िलहाल, सुधारों में बदलाव करने का कोई तरीका नहीं है. हालांकि, किसी एल्बम में जानकारी जोड़ लेने के बाद, उपयोगकर्ता Google Photos ऐप्लिकेशन की मदद से उस जानकारी में बदलाव कर सकता है.