mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Fixed scaled image medium filename when using non-existing retina file
This commit is contained in:
parent
bd471cb61b
commit
55b45fcf2f
|
|
@ -11,6 +11,7 @@
|
|||
* Reorganized the Asset system configuration blueprint for clarity
|
||||
3. [](#bugfix)
|
||||
* Fixed CLI `--env` and `--lang` options having no effect if they aren't added before all the other options
|
||||
* Fixed scaled image medium filename when using non-existing retina file
|
||||
|
||||
# v1.7.26.1
|
||||
## 01/04/2022
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ use Grav\Common\Media\Traits\MediaObjectTrait;
|
|||
* @package Grav\Common\Page\Medium
|
||||
*
|
||||
* @property string $filepath
|
||||
* @property string $filename
|
||||
* @property string $basename
|
||||
* @property string $mime
|
||||
* @property int $size
|
||||
* @property int $modified
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ class MediumFactory
|
|||
$height = $medium->get('height') * $ratio;
|
||||
|
||||
$prev_basename = $medium->get('basename');
|
||||
$basename = str_replace('@'.$from.'x', '@'.$to.'x', $prev_basename);
|
||||
$basename = str_replace('@' . $from . 'x', $to !== 1 ? '@' . $to . 'x' : '', $prev_basename);
|
||||
|
||||
$debug = $medium->get('debug');
|
||||
$medium->set('debug', false);
|
||||
|
|
@ -208,6 +208,8 @@ class MediumFactory
|
|||
|
||||
$medium = self::fromFile($file);
|
||||
if ($medium) {
|
||||
$medium->set('basename', $basename);
|
||||
$medium->set('filename', $basename . '.' . $medium->extension);
|
||||
$medium->set('size', $size);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user