echo $lang['img_copyr']; ?> </label> <input type="text" name="meta[Iptc.CopyrightNotice]" id="copy" class="edit" value="<?php echo hsc(tpl_img_getTag(array('Iptc.CopyrightNotice', 'Exif.TIFFCopyright', 'Exif.Copyright'))); ?> " /><br /> <label for="keywords"><?php echo $lang['img_keywords']; ?> </label> <textarea name="meta[Iptc.Keywords]" id="keywords" class="edit"><?php echo hsc(tpl_img_getTag(array('IPTC.Keywords', 'EXIF.Category'))); ?> </textarea><br /> <input type="submit" value="<?php echo $lang['btn_save']; ?> " title="ALT+S" accesskey="s" class="button" /> </form> </div> <div class="footer">
/** * Prints the image with a link to the full sized version * * Only allowed in: detail.php * * @triggers TPL_IMG_DISPLAY * @param $maxwidth int - maximal width of the image * @param $maxheight int - maximal height of the image * @param $link bool - link to the orginal size? * @param $params array - additional image attributes * @return mixed Result of TPL_IMG_DISPLAY */ function tpl_img($maxwidth = 0, $maxheight = 0, $link = true, $params = null) { global $IMG; global $INPUT; $w = tpl_img_getTag('File.Width'); $h = tpl_img_getTag('File.Height'); //resize to given max values $ratio = 1; if ($w >= $h) { if ($maxwidth && $w >= $maxwidth) { $ratio = $maxwidth / $w; } elseif ($maxheight && $h > $maxheight) { $ratio = $maxheight / $h; } } else { if ($maxheight && $h >= $maxheight) { $ratio = $maxheight / $h; } elseif ($maxwidth && $w > $maxwidth) { $ratio = $maxwidth / $w; } } if ($ratio) { $w = floor($ratio * $w); $h = floor($ratio * $h); } //prepare URLs $url = ml($IMG, array('cache' => $INPUT->str('cache')), true, '&'); $src = ml($IMG, array('cache' => $INPUT->str('cache'), 'w' => $w, 'h' => $h), true, '&'); //prepare attributes $alt = tpl_img_getTag('Simple.Title'); if (is_null($params)) { $p = array(); } else { $p = $params; } if ($w) { $p['width'] = $w; } if ($h) { $p['height'] = $h; } $p['class'] = 'img_detail'; if ($alt) { $p['alt'] = $alt; $p['title'] = $alt; } else { $p['alt'] = ''; } $p['src'] = $src; $data = array('url' => $link ? $url : null, 'params' => $p); return trigger_event('TPL_IMG_DISPLAY', $data, '_tpl_img_action', true); }
<?php $config_files = getConfigFiles('mediameta'); foreach ($config_files as $config_file) { if (@file_exists($config_file)) { include $config_file; } } foreach ($fields as $key => $tag) { $t = array(); if (!empty($tag[0])) { $t = array($tag[0]); } if (is_array($tag[3])) { $t = array_merge($t, $tag[3]); } $value = tpl_img_getTag($t); if ($value) { echo '<dt>' . $lang[$tag[1]] . ':</dt><dd>'; if ($tag[2] == 'date') { echo dformat($value); } else { echo hsc($value); } echo '</dd>'; } } ?> </dl> <?php //Comment in for Debug// dbg(tpl_img_getTag('Simple.Raw')); ?>
if ($t) { print '<dt>' . $lang['img_copyr'] . ':</dt><dd>' . hsc($t) . '</dd>'; } $t = tpl_img_getTag('File.Format'); if ($t) { print '<dt>' . $lang['img_format'] . ':</dt><dd>' . hsc($t) . '</dd>'; } $t = tpl_img_getTag('File.NiceSize'); if ($t) { print '<dt>' . $lang['img_fsize'] . ':</dt><dd>' . hsc($t) . '</dd>'; } $t = tpl_img_getTag('Simple.Camera'); if ($t) { print '<dt>' . $lang['img_camera'] . ':</dt><dd>' . hsc($t) . '</dd>'; } $t = tpl_img_getTag(array('IPTC.Keywords', 'IPTC.Category', 'xmp.dc:subject')); if ($t) { print '<dt>' . $lang['img_keywords'] . ':</dt><dd>' . hsc($t) . '</dd>'; } ?> </dl> <?php //Comment in for Debug// dbg(tpl_img_getTag('Simple.Raw')); ?> </div> <?php } ?> </div> </div>
<?php tpl_includeFile('pageheader.html'); ?> <!-- detail start --> <?php if ($ERROR) { echo '<h1>' . $ERROR . '</h1>'; } else { ?> <?php if ($REV) { echo p_locale_xhtml('showrev'); } ?> <h1><?php echo nl2br(hsc(tpl_img_getTag('simple.title'))); ?> </h1> <?php tpl_img(900, 700); /* parameters: maximum width, maximum height (and more) */ ?> <div class="img_detail"> <?php tpl_img_meta(); ?> <dl> <?php echo '<dt>' . $lang['reference'] . ':</dt>';
$back_to = str_replace('action', 'action btn btn-success', $back_to); $media_mgr = str_replace('action', 'action btn btn-default', $media_mgr); echo $back_to . "\n" . $media_mgr; ?> </div> <div class="modal fade" tabindex="-1" id="detail-dialog" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="<?php echo $lang['js']['mediaclose']; ?> "><span aria-hidden="true">×</span></button> <h4 class="modal-title"><i class="fa fa-fw fa-info-circle text-primary"></i> <?php echo hsc(tpl_img_getTag('IPTC.Headline', $IMG)); ?> </h4> </div> <div class="modal-body"> <?php tpl_img_meta(); //Comment in for Debug //dbg(tpl_img_getTag('Simple.Raw')); ?> <hr/> <dl class="dl-horizontal"> <?php
} if (is_array($tag[3])) { $t = array_merge($t, $tag[3]); } $value = tpl_img_getTag($t); if ($value) { echo '<dt>' . $lang[$tag[1]] . ':</dt><dd>'; if ($tag[2] == 'date') { echo dformat($value); } else { echo hsc($value); } echo '</dd>'; } } $t_array = media_inuse(tpl_img_getTag('IPTC.File.Name', $IMG)); if (isset($t_array[0])) { echo '<dt>' . $lang['reference'] . ':</dt>'; foreach ($t_array as $t) { echo '<dd>' . html_wikilink($t, $t) . '</dd>'; } } ?> </dl> <?php //Comment in for Debug// dbg(tpl_img_getTag('Simple.Raw')); ?> </div> <div class="clearer"></div> </div><!-- /.content -->
if ($t) { print '<dt>' . $lang['img_copyr'] . ':</dt><dd>' . hsc($t) . '</dd>'; } $t = tpl_img_getTag('File.Format'); if ($t) { print '<dt>' . $lang['img_format'] . ':</dt><dd>' . hsc($t) . '</dd>'; } $t = tpl_img_getTag('File.NiceSize'); if ($t) { print '<dt>' . $lang['img_fsize'] . ':</dt><dd>' . hsc($t) . '</dd>'; } $t = tpl_img_getTag('Simple.Camera'); if ($t) { print '<dt>' . $lang['img_camera'] . ':</dt><dd>' . hsc($t) . '</dd>'; } $t = tpl_img_getTag(array('IPTC.Keywords', 'IPTC.Category')); if ($t) { print '<dt>' . $lang['img_keywords'] . ':</dt><dd>' . hsc($t) . '</dd>'; } ?> </dl> <?php //Comment in for Debug// dbg(tpl_img_getTag('Simple.Raw')); ?> </div> <?php } ?> </div> </div>
/** * Display the form to edit image meta data * * @author Andreas Gohr <*****@*****.**> * @author Kate Arzamastseva <*****@*****.**> */ function media_metaform($id, $auth) { global $lang; if ($auth < AUTH_UPLOAD) { echo '<div class="nothing">' . $lang['media_perm_upload'] . '</div>' . NL; return false; } // load the field descriptions static $fields = null; if (is_null($fields)) { $config_files = getConfigFiles('mediameta'); foreach ($config_files as $config_file) { if (@file_exists($config_file)) { include $config_file; } } } $src = mediaFN($id); // output $form = new Doku_Form(array('action' => media_managerURL(array('tab_details' => 'view'), '&'), 'class' => 'meta')); $form->addHidden('img', $id); $form->addHidden('mediado', 'save'); foreach ($fields as $key => $field) { // get current value if (empty($field[0])) { continue; } $tags = array($field[0]); if (is_array($field[3])) { $tags = array_merge($tags, $field[3]); } $value = tpl_img_getTag($tags, '', $src); $value = cleanText($value); // prepare attributes $p = array(); $p['class'] = 'edit'; $p['id'] = 'meta__' . $key; $p['name'] = 'meta[' . $field[0] . ']'; $p_attrs = array('class' => 'edit'); $form->addElement('<div class="row">'); if ($field[2] == 'text') { $form->addElement(form_makeField('text', $p['name'], $value, $lang[$field[1]] ? $lang[$field[1]] : $field[1] . ':', $p['id'], $p['class'], $p_attrs)); } else { $att = buildAttributes($p); $form->addElement('<label for="meta__' . $key . '">' . $lang[$field[1]] . '</label>'); $form->addElement("<textarea {$att} rows=\"6\" cols=\"50\">" . formText($value) . '</textarea>'); } $form->addElement('</div>' . NL); } $form->addElement('<div class="buttons">'); $form->addElement(form_makeButton('submit', '', $lang['btn_save'], array('accesskey' => 's', 'name' => 'mediado[save]'))); $form->addElement('</div>' . NL); $form->printForm(); return true; }
?> <div class="content" style="width: <?php echo tpl_img_getTag('File.Width') + 10; ?> px; padding-top: 15px;"> <center> <?php #tpl_img(); ?> <img src="<?php echo ml($IMG); ?> " width="<?php echo tpl_img_getTag('File.Width'); ?> " height="<? echo tpl_img_getTag('File.Height')?>"> <br><br>Back to <?php echo tpl_pagelink($ID); ?> <br><br> </center> </div> </div> <?php flush(); ?> </div> <?php tpl_indexerWebBug();
/** * Display the form to edit image meta data * * @author Andreas Gohr <*****@*****.**> */ function media_metaform($id, $auth) { if ($auth < AUTH_UPLOAD) { return false; } global $lang, $config_cascade; // load the field descriptions static $fields = null; if (is_null($fields)) { foreach (array('default', 'local') as $config_group) { if (empty($config_cascade['mediameta'][$config_group])) { continue; } foreach ($config_cascade['mediameta'][$config_group] as $config_file) { if (@file_exists($config_file)) { include $config_file; } } } } $src = mediaFN($id); // output echo '<h1>' . hsc(noNS($id)) . '</h1>' . NL; echo '<form action="' . DOKU_BASE . 'lib/exe/mediamanager.php" accept-charset="utf-8" method="post" class="meta">' . NL; formSecurityToken(); foreach ($fields as $key => $field) { // get current value $tags = array($field[0]); if (is_array($field[3])) { $tags = array_merge($tags, $field[3]); } $value = tpl_img_getTag($tags, '', $src); $value = cleanText($value); // prepare attributes $p = array(); $p['class'] = 'edit'; $p['id'] = 'meta__' . $key; $p['name'] = 'meta[' . $field[0] . ']'; // put label echo '<div class="metafield">'; echo '<label for="meta__' . $key . '">'; echo $lang[$field[1]] ? $lang[$field[1]] : $field[1]; echo ':</label>'; // put input field if ($field[2] == 'text') { $p['value'] = $value; $p['type'] = 'text'; $att = buildAttributes($p); echo "<input {$att}/>" . NL; } else { $att = buildAttributes($p); echo "<textarea {$att} rows=\"6\" cols=\"50\">" . formText($value) . '</textarea>' . NL; } echo '</div>' . NL; } echo '<div class="buttons">' . NL; echo '<input type="hidden" name="img" value="' . hsc($id) . '" />' . NL; echo '<input name="do[save]" type="submit" value="' . $lang['btn_save'] . '" title="' . $lang['btn_save'] . ' [S]" accesskey="s" class="button" />' . NL; echo '<input name="do[cancel]" type="submit" value="' . $lang['btn_cancel'] . '" title="' . $lang['btn_cancel'] . ' [C]" accesskey="c" class="button" />' . NL; echo '</div>' . NL; echo '</form>' . NL; }
/** * Prints the image with a link to the full sized version * * Only allowed in: detail.php */ function tpl_img($maxwidth = 0, $maxheight = 0) { global $IMG; $w = tpl_img_getTag('File.Width'); $h = tpl_img_getTag('File.Height'); //resize to given max values $ratio = 1; if ($w >= $h) { if ($maxwidth && $w >= $maxwidth) { $ratio = $maxwidth / $w; } elseif ($maxheight && $h > $maxheight) { $ratio = $maxheight / $h; } } else { if ($maxheight && $h >= $maxheight) { $ratio = $maxheight / $h; } elseif ($maxwidth && $w > $maxwidth) { $ratio = $maxwidth / $w; } } if ($ratio) { $w = floor($ratio * $w); $h = floor($ratio * $h); } //prepare URLs $url = ml($IMG, array('cache' => $_REQUEST['cache'])); $src = ml($IMG, array('cache' => $_REQUEST['cache'], 'w' => $w, 'h' => $h)); //prepare attributes $alt = tpl_img_getTag('Simple.Title'); $p = array(); if ($w) { $p['width'] = $w; } if ($h) { $p['height'] = $h; } $p['class'] = 'img_detail'; if ($alt) { $p['alt'] = $alt; $p['title'] = $alt; } else { $p['alt'] = ''; } $p = buildAttributes($p); print '<a href="' . $url . '">'; print '<img src="' . $src . '" ' . $p . '/>'; print '</a>'; return true; }