Changes by Undagiga to add selected IPTC fields
This commit is contained in:
parent
828ece294e
commit
36375b226c
@ -27,6 +27,10 @@ class about_this_photo_block_Core {
|
||||
$block = new Block();
|
||||
switch ($block_id) {
|
||||
case "simple":
|
||||
$item = $theme->item;
|
||||
if ((!$item) or (!$item->is_photo())) {
|
||||
return "";
|
||||
}
|
||||
$block->css_id = "g-about-this-photo";
|
||||
$block->title = t("About this photo");
|
||||
$block->content = new View("about_this_photo.html");
|
||||
@ -37,11 +41,25 @@ class about_this_photo_block_Core {
|
||||
if ($exif->loaded()) {
|
||||
$exif = unserialize($exif->data);
|
||||
$timestamp = strtotime($exif["DateTime"]);
|
||||
$block->content->date = gallery::date($timestamp);
|
||||
//$block->content->date = gallery::date($timestamp);
|
||||
$block->content->date = date('D j M Y', $timestamp);
|
||||
$block->content->time = gallery::time($timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
$block->content->vcount = $theme->item()->view_count;
|
||||
|
||||
// IPTC - copied more or less from iptc.php
|
||||
if (module::is_active("iptc")) {
|
||||
$record = ORM::factory("iptc_record")->where("item_id", "=", $theme->item()->id)->find();
|
||||
if ($record->loaded()) {
|
||||
$record = unserialize($record->data);
|
||||
$block->content->source = $record["Source"];
|
||||
$block->content->caption = $record["Caption"];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (module::is_active("tag")) {
|
||||
$block->content->tags = tag::item_tags($theme->item());
|
||||
}
|
||||
@ -50,3 +68,4 @@ class about_this_photo_block_Core {
|
||||
return $block;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
name = "About this Photo"
|
||||
description = "Show some simple, specific and useful info about a given photo"
|
||||
version = 1
|
||||
version = 2
|
||||
|
@ -1,17 +1,34 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<ul class="g-metadata">
|
||||
<li>
|
||||
<strong class="caption"><?= t("Date:") ?></strong>
|
||||
<?= $date ?>
|
||||
</li>
|
||||
<li>
|
||||
<strong class="caption"><?= t("Time:") ?></strong>
|
||||
<?= $time ?>
|
||||
</li>
|
||||
<li>
|
||||
<strong class=="caption"><?= t("Tags:") ?></strong>
|
||||
<? date_default_timezone_set('Australia/ACT'); ?>
|
||||
<div class="g-metadata">
|
||||
<span class="g-about-this">
|
||||
<table cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td><strong class="caption"><?= t("Date: ") ?></strong></td>
|
||||
<td><?= $date ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong class="caption"><?= t("Time: ") ?></strong></td>
|
||||
<td><?= $time ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong class="caption"><?= t("Views: ") ?></strong></td>
|
||||
<td><?= $vcount ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong class="caption"><?= t("Image ID: ") ?></strong></td>
|
||||
<td><?= $source ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<span >
|
||||
<strong class="caption"><?= t("Caption: ") ?></strong>
|
||||
<?= $caption ?>
|
||||
</span ><br>
|
||||
<span >
|
||||
<strong class=="caption"><?= t("Tags: ") ?></strong>
|
||||
<? foreach ($tags as $tag): ?>
|
||||
<a href="<?= $tag->url() ?>"><?= html::clean($tag->name) ?></a>
|
||||
<a href="<?= $tag->url() ?>"><?= html::clean($tag->name) ?></a>,
|
||||
<? endforeach?>
|
||||
</li>
|
||||
</ul>
|
||||
</span ><br>
|
||||
</span>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user