Added image info option to admin, changed the info template parser to not use the url-escaped option

This commit is contained in:
Matthew Barbour 2020-08-28 09:41:25 -05:00
parent 988bc831b2
commit 4c5ef85906
3 changed files with 15 additions and 1 deletions

View file

@ -546,6 +546,19 @@ class Image
return $plte->text;
}
/**
* Get the info for this image, formatted according to the
* configured template.
*/
public function get_info(): string
{
global $config;
$plte = new ParseLinkTemplateEvent($config->get_string(ImageConfig::INFO), $this);
send_event($plte);
return $plte->text;
}
/**
* Figure out where the full size image is on disk.
*/

View file

@ -252,6 +252,7 @@ class ImageIO extends Extension
//$sb->add_text_option(ImageConfig::ILINK, "Image link: ");
//$sb->add_text_option(ImageConfig::TLINK, "<br>Thumbnail link: ");
$sb->add_text_option(ImageConfig::TIP, "Image tooltip", true);
$sb->add_text_option(ImageConfig::INFO, "Image info", true);
$sb->add_choice_option(ImageConfig::UPLOAD_COLLISION_HANDLER, self::COLLISION_OPTIONS, "Upload collision handler", true);
if (function_exists(self::EXIF_READ_FUNCTION)) {
$sb->add_bool_option(ImageConfig::SHOW_META, "Show metadata", true);

View file

@ -109,7 +109,7 @@ class ViewImage extends Extension
if ($image_info) {
$html = (string)TR(
TH("Info"),
TD($event->image->parse_link_template($image_info))
TD($event->image->get_info())
);
$event->add_part($html, 85);
}