Skip to content

Commit

Permalink
Merge pull request #2194 from omeka/primary-media-thumbnail
Browse files Browse the repository at this point in the history
Return the asset URL if the primary media has a custom thumbnail
  • Loading branch information
zerocrates authored May 24, 2024
2 parents 1a04571 + ef39764 commit f56afcf
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion application/src/Api/Representation/AbstractRepresentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,17 @@ public function thumbnailDisplayUrl($type)
return null;
}

return $thumbnail ? $thumbnail->assetUrl() : $primaryMedia->thumbnailUrl($type);
if ($thumbnail) {
// Return the asset URL if the resource has a custom thumbnail.
return $thumbnail->assetUrl();
}
$primaryMediaThumbnail = $primaryMedia->thumbnail();
if ($primaryMediaThumbnail) {
// Return the asset URL if the primary media has a custom thumbnail.
return $primaryMediaThumbnail->assetUrl();
}
// Return the primary media's thumbnail URL.
return $primaryMedia->thumbnailUrl($type);
}

/**
Expand Down

0 comments on commit f56afcf

Please sign in to comment.