From 19dfa4e011fab54e67a08c3ae373c094018d347e Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 14 Oct 2016 14:14:11 -0600 Subject: [PATCH 1/2] Fixed responsive pretty names --- system/src/Grav/Common/Page/Medium/ImageMedium.php | 13 +++++++++++++ .../src/Grav/Common/Page/Medium/MediumFactory.php | 6 ++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/system/src/Grav/Common/Page/Medium/ImageMedium.php b/system/src/Grav/Common/Page/Medium/ImageMedium.php index 521c41c0a..fa7d53256 100644 --- a/system/src/Grav/Common/Page/Medium/ImageMedium.php +++ b/system/src/Grav/Common/Page/Medium/ImageMedium.php @@ -223,6 +223,19 @@ class ImageMedium extends Medium return implode(', ', $srcset); } + /** + * Allows the ability to override the Inmage's Pretty name stored in cache + * + * @param $name + */ + public function setImagePrettyName($name) + { + $this->set('basename', $name); + if ($this->image) { + $this->image->setPrettyName($name); + } + } + /** * Generate derivatives * diff --git a/system/src/Grav/Common/Page/Medium/MediumFactory.php b/system/src/Grav/Common/Page/Medium/MediumFactory.php index 14eb75f66..c75044f5c 100644 --- a/system/src/Grav/Common/Page/Medium/MediumFactory.php +++ b/system/src/Grav/Common/Page/Medium/MediumFactory.php @@ -122,15 +122,17 @@ class MediumFactory $width = (int) ($medium->get('width') * $ratio); $height = (int) ($medium->get('height') * $ratio); - $basename = $medium->get('basename'); - $basename = str_replace('@'.$from.'x', '@'.$to.'x', $basename); + $prev_basename = $medium->get('basename'); + $basename = str_replace('@'.$from.'x', '@'.$to.'x', $prev_basename); $debug = $medium->get('debug'); $medium->set('debug', false); + $medium->setImagePrettyName($basename); $file = $medium->resize($width, $height)->path(); $medium->set('debug', $debug); + $medium->setImagePrettyName($prev_basename); $size = filesize($file); From 851dec76d20adb234bba6c47a656fb87e08c419b Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 14 Oct 2016 16:11:49 -0600 Subject: [PATCH 2/2] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42414f3c2..7ce70b58d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ * It is now possible to opt-out of the SSL verification via the new `system.gpm.verify_peer` setting. This is sometimes necessary when receiving a "GPM Unable to Connect" error. More details in ([#1053](https://github.com/getgrav/grav/issues/1053)) * It is now possible to force the use of either `curl` or `fopen` as `Response` connection method, via the new `system.gpm.method` setting. By default this is set to 'auto' and gives priority to 'fopen' first, curl otherwise. * InstallCommand can now handle Licenses + * Uses more helpful `1x`, `2x`, `3x`, etc names in the Retina derivatives cache files. * Added new method `Plugins::isPluginActiveAdmin()` to check if plugin route is active in Admin plugin * Added new `Cache::setEnabled` and `Cache::getEnabled` to enable outside control of cache * Updated vendor libs including Twig `1.25.0`