show iptc data of jpeg if available

This commit is contained in:
Uwe Steinmann 2022-09-15 13:08:56 +02:00
parent 5a806f729b
commit d2eee3345f

View File

@ -192,6 +192,38 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
echo json_encode($jsondata);
} /* }}} */
protected function iptcdata($arr) { /* {{{ */
$iptcHeaderArray = array (
'2#005'=>'DocumentTitle',
'2#010'=>'Urgency',
'2#015'=>'Category',
'2#025'=>'Keywords',
'2#020'=>'Subcategories',
'2#040'=>'SpecialInstructions',
'2#055'=>'CreationDate',
'2#080'=>'AuthorByline',
'2#085'=>'AuthorTitle',
'2#090'=>'City',
'2#095'=>'State',
'2#101'=>'Country',
'2#103'=>'OTR',
'2#105'=>'Headline',
'2#110'=>'Source',
'2#115'=>'PhotoSource',
'2#116'=>'Copyright',
'2#120'=>'Caption',
'2#122'=>'CaptionWriter'
);
$retStr = '<table class="table">';
if(is_array($arr)) {
foreach ($arr as $key=>$val) {
$retStr .= '<tr><td>' . $iptcHeaderArray[$key] . '</td><td>' . htmlspecialchars(implode('; ', $val)) . '</td></tr>';
}
}
$retStr .= '</table>';
return $retStr;
} /* }}} */
function js() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
@ -352,7 +384,7 @@ $(document).ready( function() {
if(is_string($txt))
echo $txt;
else {
$this->contentHeading(getMLText("document_infos"));
$this->contentHeading(htmlspecialchars($document->getName()));
$txt = $this->callHook('preDocumentInfos', $document);
if(is_string($txt))
echo $txt;
@ -689,11 +721,22 @@ $(document).ready( function() {
$this->columnEnd();
$this->columnStart(4);
print "<ul class=\"actions unstyled\">\n";
print "<li>".htmlspecialchars($latestContent->getOriginalFileName())."</li>\n";
print "<li>".getMLText('version').": ".$latestContent->getVersion()."</li>\n";
if ($file_exists)
print "<li>". SeedDMS_Core_File::format_filesize($latestContent->getFileSize()) .", ".htmlspecialchars($latestContent->getMimeType())."</li>";
else print "<li><span class=\"warning\">".getMLText("document_deleted")."</span></li>";
if ($file_exists) {
print "<li>". SeedDMS_Core_File::format_filesize($latestContent->getFileSize()) .", ";
print htmlspecialchars($latestContent->getMimeType());
if(in_array($latestContent->getMimeType(), ['image/jpeg', 'image/jpg', 'image/png', 'image/bmp'])) {
$imsize = getimagesize($dms->contentDir . $latestContent->getPath(), $moreinfo);
if(!empty($moreinfo['APP13'])) {
echo ', '.$this->printPopupBox(getMLText('iptc_metadata'), $this->iptcdata(iptcparse($moreinfo['APP13'])), true);
}
if($imsize[0] && $imsize[1])
print ', '.$imsize[0].'×'.$imsize[1].' px';
}
print "</li>";
} else print "<li><span class=\"warning\">".getMLText("document_deleted")."</span></li>";
$updatingUser = $latestContent->getUser();
print "<li>".getMLText("uploaded_by")." <a href=\"mailto:".htmlspecialchars($updatingUser->getEmail())."\">".htmlspecialchars($updatingUser->getFullName())."</a></li>";