Display Interface and Background Images not working properly
fabeat opened this issue · 0 comments
fabeat commented
Hi,
I am trying to add a background image to a Display Interface body template.
I tried the following code:
$backgroundImage = new Image();
$backgroundImage->contentDescription = "Some Background";
$imageSource = new ImageSource();
$imageSource->url = 'https://example.com/some/image.jpg';
$backgroundImage->sources = [$imageSource];
$template->backgroundImage = $backgroundImage;
This code produces the following JSON response:
"sources": [
{
"url": "https://example.com/some/image.jpg",
"size": null,
"widthPixels": null,
"heightPixels": null
}
]
The Amazon API seems to have a problem with the empty values (for size, widthPixels and heightPixels)
This code works fine:
$backgroundImage = new Image();
$backgroundImage->contentDescription = "Some Background";
$backgroundImage->sources = [['url' => 'https://example.com/some/image.jpg']];
The properties for for size, widthPixels and heightPixels should therefore be omited in the response.
Cheers,
Fabian