Add debug for asset_content_info structure and try all renditions

This commit is contained in:
DJP 2025-10-17 15:52:44 -04:00
parent 9bf6813575
commit 8cfa971078

View file

@ -386,11 +386,15 @@ function downloadAsset($testRunner, $assetId, $filename, $campaignId, $assetData
$alternativeRenditions = [];
if ($assetData && isset($assetData['asset_content_info'])) {
foreach ($assetData['asset_content_info'] as $contentInfo) {
if (is_array($contentInfo) && isset($contentInfo['url']) && isset($contentInfo['rendition_type'])) {
$rendType = $contentInfo['rendition_type'];
// Try preview, thumbnail, or any other available rendition
if (in_array($rendType, ['preview_content', 'thumbnail_content', 'PREVIEW', 'THUMBNAIL'])) {
$debugInfo['asset_content_info_count'] = count($assetData['asset_content_info']);
foreach ($assetData['asset_content_info'] as $key => $contentInfo) {
if (is_array($contentInfo)) {
$rendType = $contentInfo['rendition_type'] ?? $key;
$debugInfo['content_info_keys'][] = $key;
if (isset($contentInfo['url'])) {
// Add ALL renditions, not just preview/thumbnail
$alternativeRenditions[] = [
'url' => str_replace('/otmmapi/', '/', $contentInfo['url']),
'type' => $rendType
@ -398,6 +402,8 @@ function downloadAsset($testRunner, $assetId, $filename, $campaignId, $assetData
}
}
}
$debugInfo['alternative_renditions_found'] = count($alternativeRenditions);
}
// Try alternative renditions