This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/handle_pixel/theme.php

37 lines
1.4 KiB
PHP
Raw Normal View History

2020-01-26 13:19:35 +00:00
<?php declare(strict_types=1);
class PixelFileHandlerTheme extends Themelet
{
public function display_image(Page $page, Image $image)
{
global $config;
2009-08-09 21:00:59 +00:00
$u_ilink = $image->get_image_link();
if ($config->get_bool(ImageConfig::SHOW_META) && function_exists(ImageIO::EXIF_READ_FUNCTION)) {
# FIXME: only read from jpegs?
$exif = @exif_read_data($image->get_image_filename(), 0, true);
if ($exif) {
$head = "";
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
if ($key == "IFD0") {
// Cheap fix for array'd values in EXIF-data
if (is_array($val)) {
$val = implode(',', $val);
}
$head .= html_escape("$name: $val")."<br>\n";
}
}
}
if ($head) {
$page->add_block(new Block("EXIF Info", $head, "left"));
}
}
}
2010-08-06 23:24:31 +00:00
$html = "<img alt='main image' class='shm-main-image' id='main_image' src='$u_ilink' ".
"data-width='{$image->width}' data-height='{$image->height}'>";
$page->add_block(new Block("Image", $html, "main", 10));
}
}