mirror of
https://github.com/getgrav/grav.git
synced 2026-07-05 16:49:18 +02:00
Merge branch 'feature/fixed_responsive_prettynames' into develop
This commit is contained in:
@@ -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`
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user