Skip to content

Commit

Permalink
PLANET 7299 Fix Media archive image import size
Browse files Browse the repository at this point in the history
Import 1200px width image available in 'TR1' field of OL API
  • Loading branch information
sagarsdeshmukh authored and comzeradd committed Oct 24, 2023
1 parent 0be0676 commit 6710931
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/MediaArchive/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,11 @@ public static function from_api_response(array $data, array $images_in_wordpress
$image->original_language_title = $data['original-language-title'] ?? null;
$image->original_language_description = $data['original-language-description'] ?? null;

$largest_size = 0;
foreach ($image->sizes as $size) {
if ($size->get_width() <= $largest_size) {
// The suitable image size to import in P4 is w1200px which is available in TR1 field.
if ($size->getUrl() !== $data['Path_TR1']['URI']) {
continue;
}

$largest_size = $size->get_width();
$image->original = $size;
}

Expand Down

0 comments on commit 6710931

Please sign in to comment.