Merge pull request #748 from sanmadjack/image_info

Added image info option to admin, changed the info template parser to…
This commit is contained in:
Shish 2020-09-16 11:21:31 +01:00 committed by GitHub
commit 4131bcbd64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);
}