mirror of
https://github.com/getgrav/grav.git
synced 2026-07-11 02:33:41 +02:00
new option for image.prettyname_prefix
This commit is contained in:
@@ -1062,6 +1062,17 @@ form:
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
images.prettyname_prefix:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.IMAGES_PRETTYNAME_PREFIX
|
||||
help: PLUGIN_ADMIN.IMAGES_PRETTYNAME_PREFIX_HELP
|
||||
highlight: 1
|
||||
options:
|
||||
1: PLUGIN_ADMIN.YES
|
||||
0: PLUGIN_ADMIN.NO
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
media.enable_media_timestamp:
|
||||
type: toggle
|
||||
label: PLUGIN_ADMIN.ENABLE_MEDIA_TIMESTAMP
|
||||
|
||||
@@ -133,6 +133,7 @@ images:
|
||||
cache_perms: '0755' # MUST BE IN QUOTES!! Default cache folder perms. Usually '0755' or '0775'
|
||||
debug: false # Show an overlay over images indicating the pixel depth of the image when working with retina for example
|
||||
auto_fix_orientation: false # Automatically fix the image orientation based on the Exif data
|
||||
prettyname_prefix: true # The hash prefix, set to false to not include hash prefix
|
||||
|
||||
media:
|
||||
enable_media_timestamp: false # Enable media timestamps
|
||||
|
||||
@@ -240,7 +240,8 @@ class ImageMedium extends Medium
|
||||
{
|
||||
$this->set('prettyname', $name);
|
||||
if ($this->image) {
|
||||
$this->image->setPrettyName($name);
|
||||
$prefix = Grav::instance()['config']->get('system.images.prettyname_prefix', true);
|
||||
$this->image->setPrettyName($name, $prefix);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -583,10 +584,13 @@ class ImageMedium extends Medium
|
||||
// Make sure we free previous image.
|
||||
unset($this->image);
|
||||
|
||||
// Get prefix
|
||||
$prefix = Grav::instance()['config']->get('system.images.prettyname_prefix', true);
|
||||
|
||||
$this->image = ImageFile::open($file)
|
||||
->setCacheDir($cacheDir)
|
||||
->setActualCacheDir($cacheDir)
|
||||
->setPrettyName($this->getImagePrettyName());
|
||||
->setPrettyName($this->getImagePrettyName(), $prefix);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user