diff --git a/CHANGELOG.md b/CHANGELOG.md index 22909a3c..18c16afa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * `base.html.twig` now extends a `base-root.html.twig` file * Add month+date indication to the stats graph to avoid confusion when there are days without visits * Added `min` and `max` options for `list` form field [#1113](https://github.com/getgrav/grav-plugin-admin/pull/1113) + * Remove page metadata file on deletion of media 1. [](#bugfix) * Fixed issue with tab widths on Pages overlapping non-english toggle switch [#1089](https://github.com/getgrav/grav-plugin-admin/issues/1089) * Added `vendor` to ignores for direct install of Grav @@ -14,6 +15,7 @@ * Fixed an quote error in `en.yaml` * Resolved z-index issues with mobile nav and pages form elements * Fixed issue with file picker where the selected file preview would not show + * Refresh page media on media upload * Default to config file slug if translation is missing, otherwise use translation also in the tab title, not just in the page heading [#1039](https://github.com/getgrav/grav-plugin-admin/issues/1039) * Fix language toggle button in admin top bar visible also in fullscreen mode [#1110](https://github.com/getgrav/grav-plugin-admin/issues/1110) * Fix for editor padding [#1111](https://github.com/getgrav/grav-plugin-admin/issues/1111) diff --git a/classes/admincontroller.php b/classes/admincontroller.php index 051a9a55..72170e10 100644 --- a/classes/admincontroller.php +++ b/classes/admincontroller.php @@ -1625,6 +1625,9 @@ class AdminController extends AdminBaseController return false; } + // reinitialize media to trigger availability + $page->media(); + $this->grav->fireEvent('onAdminAfterAddMedia', new Event(['page' => $page])); $this->admin->json_response = [ @@ -1687,9 +1690,9 @@ class AdminController extends AdminBaseController } } - + // Remove Extra Files foreach (scandir($page->path()) as $file) { - if (preg_match("/{$fileParts['filename']}@\d+x\.{$fileParts['extension']}$/", $file)) { + if (preg_match("/{$fileParts['filename']}@\d+x\.{$fileParts['extension']}$|{$filename}.meta.yaml$/", $file)) { $result = unlink($page->path() . '/' . $file); if (!$result) { diff --git a/languages/en.yaml b/languages/en.yaml index 811de527..7c7524d5 100644 --- a/languages/en.yaml +++ b/languages/en.yaml @@ -672,3 +672,5 @@ PLUGIN_ADMIN: USERNAME_REGEX_HELP: "By default: Only lowercase chars, digits, dashes, and underscores. 3 - 16 chars" CONTENT_PADDING: "Content padding" CONTENT_PADDING_HELP: "Enable/Disable content padding around content area to provide more space" + ENABLE_AUTO_METADATA: "Auto metadata from Exif" + ENABLE_AUTO_METADATA_HELP: "Automatically generate metadata files for images with exif information"