2020-01-26 13:19:35 +00:00
|
|
|
<?php declare(strict_types=1);
|
2007-12-06 02:26:34 +00:00
|
|
|
|
2019-05-28 17:59:38 +01:00
|
|
|
class PixelFileHandlerTheme extends Themelet
|
|
|
|
{
|
|
|
|
public function display_image(Page $page, Image $image)
|
|
|
|
{
|
|
|
|
global $config;
|
2009-08-09 22:00:59 +01:00
|
|
|
|
2019-05-28 17:59:38 +01:00
|
|
|
$u_ilink = $image->get_image_link();
|
2019-06-18 13:45:59 -05:00
|
|
|
if ($config->get_bool(ImageConfig::SHOW_META) && function_exists(ImageIO::EXIF_READ_FUNCTION)) {
|
2019-05-28 17:59:38 +01:00
|
|
|
# FIXME: only read from jpegs?
|
2020-03-25 10:50:32 +00:00
|
|
|
$exif = @exif_read_data($image->get_image_filename(), "IFD0", true);
|
2019-05-28 17:59:38 +01:00
|
|
|
if ($exif) {
|
|
|
|
$head = "";
|
|
|
|
foreach ($exif as $key => $section) {
|
|
|
|
foreach ($section as $name => $val) {
|
|
|
|
if ($key == "IFD0") {
|
2014-01-15 23:06:27 +02:00
|
|
|
// Cheap fix for array'd values in EXIF-data
|
|
|
|
if (is_array($val)) {
|
|
|
|
$val = implode(',', $val);
|
|
|
|
}
|
2019-05-28 17:59:38 +01:00
|
|
|
$head .= html_escape("$name: $val")."<br>\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($head) {
|
|
|
|
$page->add_block(new Block("EXIF Info", $head, "left"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-08-06 20:24:31 -03:00
|
|
|
|
2019-05-28 17:59:38 +01: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));
|
|
|
|
}
|
2007-12-06 02:26:34 +00:00
|
|
|
}
|