Problem/Motivation

AcquiadamAsset::getThumbnailUrlBySize() returns FALSE if it fails to download the 1280 size thumbnail.

Proposed resolution

Use a different Webdam API to generate the thumbnail. Lets use the same API that has been used here #3005252-2: Add support of 1600 image size limit.

Remaining tasks

N/A

User interface changes

A new option 1600 will be available under Image size limit configuration.

API changes

A new API function will be available generateAssetThumbnail($asset_id, $width, $height) which will use the WebDam API /ws/assets/asset_id/thumbnail. The new API will be able to generate asset of the provided size.

Data model changes

N/A

CommentFileSizeAuthor
#2 3008481-2.patch4.47 KBsubhojit777

Comments

subhojit777 created an issue. See original summary.

subhojit777’s picture

Status: Active » Needs review
StatusFileSize
new4.47 KB
subhojit777’s picture

The patch in #2 is identical to the patch in #3005252-2: Add support of 1600 image size limit. Only difference is:

diff --git a/src/Plugin/media/Source/AcquiadamAsset.php b/src/Plugin/media/Source/AcquiadamAsset.php
index b3483e2..cbafd58 100644
--- a/src/Plugin/media/Source/AcquiadamAsset.php
+++ b/src/Plugin/media/Source/AcquiadamAsset.php
@@ -687,6 +687,7 @@ class AcquiadamAsset extends MediaSourceBase {
       $biggest_matching = $thumbnails[0]->url;
       foreach ($thumbnails as $tn) {
         if (!empty($tn->url) && $thumbnail_size >= $tn->size) {
+          $biggest_matching = $tn->url;
           // Certain types do not have a 1280 size available despite returning
           // an URL. We either have to hard code mime types as they crop up, or
           // check if the URL is accessible on our own. Other URL sizes do not
@@ -694,10 +695,11 @@ class AcquiadamAsset extends MediaSourceBase {
           if (1280 == $tn->size) {
             $response = \Drupal::httpClient()->head($tn->url);
             if (403 == $response->getStatusCode()) {
-              continue;
+              // Try another API to generate thumbnail URL if the default one
+              // fails.
+              $biggest_matching = $this->generateThumbnailUrlBySize($asset, $thumbnail_size);
             }
           }
-          $biggest_matching = $tn->url;
         }
       }
       return $biggest_matching;
katherine baima’s picture

Status: Needs review » Active
japerry’s picture

Status: Active » Closed (won't fix)

8.x-1.x is now EOL, which ran on the WebDam/Bynder platform.