Skip to content

Commit

Permalink
Now store the image sub-folders by name, since the UID can be differe…
Browse files Browse the repository at this point in the history
…nt per environment (#282)

Signed-off-by: Andrew Welch <[email protected]>
  • Loading branch information
khalwat committed Jun 9, 2021
1 parent f3c1679 commit a8a4404
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/fields/OptimizedImages.php
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ protected function assembleSourceList(array $folders, bool $includeNestedFolders
foreach ($folders as $folder) {
$children = $folder->getChildren();
foreach ($children as $child) {
$sources[$child->uid] = $child->name;
$sources[$child->name] = $child->name;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/services/OptimizedImages.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public function shouldCreateVariants($field, $asset): bool
foreach ($subfolders as $subfolder) {
$folder = $asset->getFolder();
while ($folder !== null && !$createVariants) {
if ($folder->uid === $subfolder) {
if ($folder->uid === $subfolder || $folder->name === $subfolder) {
Craft::info('Matched subfolder uid: ' . print_r($subfolder, true), __METHOD__);
$createVariants = true;
} else {
Expand Down

0 comments on commit a8a4404

Please sign in to comment.