Skip to content

Commit

Permalink
Merge pull request #37 from fritzmg/patch-2
Browse files Browse the repository at this point in the history
Limit after processing the images
  • Loading branch information
qzminski committed Apr 11, 2023
2 parents 024e0b8 + 1457f29 commit 3452e13
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/ImageGenerator.php
Expand Up @@ -51,12 +51,6 @@ public function generateImages(array $images, array $settings): array

$settings['size'] = StringUtil::deserialize($settings['size']);
$settings['resize'] = StringUtil::deserialize($settings['resize']);

// Limit the images
if ($settings['limit'] > 0) {
$images = \array_slice($images, 0, (int) $settings['limit']);
}

$return = [];

foreach ($images as $image) {
Expand All @@ -82,6 +76,11 @@ public function generateImages(array $images, array $settings): array
];
}

// Limit the images
if ($settings['limit'] > 0) {
$return = \array_slice($return, 0, (int) $settings['limit']);
}

return $return;
}

Expand Down

0 comments on commit 3452e13

Please sign in to comment.