mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-02 04:15:05 +02:00
issue #2170 update picture tpl to embed pdf reader
Add default config pdf_viewer_filesize_threshold Add function to get number of PDF pages Add translations update picture.php to send pdf filesize threshold and nb page to tpl update picture.tpl to add number of pages for PDF picture_content.tpl update for new config name and add translation functions. use embed for pdf if file ext = pdf
This commit is contained in:
@@ -234,6 +234,14 @@ y.callService(
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if isset($PDF_NB_PAGES) and $current.path_ext=="pdf" }
|
||||
<div id="Pages" class="imageInfo">
|
||||
<dt>{'Pages'|@translate}</dt>
|
||||
<dd>{$PDF_NB_PAGES}</dd>
|
||||
</tr>
|
||||
|
||||
{/if}
|
||||
|
||||
{if $display_info.rating_score and isset($rate_summary)}
|
||||
<div id="Average" class="imageInfo">
|
||||
<dt>{'Rating score'|@translate}</dt>
|
||||
|
||||
@@ -4,7 +4,20 @@
|
||||
{footer_script}var error_icon = "{$ROOT_URL}{$themeconf.icon_dir}/errors_small.png"{/footer_script}
|
||||
{/if}
|
||||
|
||||
<img class="file-ext-{if isset($current.file_ext)}{$current.file_ext}{/if} path-ext-{if isset($current.path_ext)}{$current.path_ext}{/if}" {if (isset($current.path_ext) and $current.path_ext == 'svg')} src="{$current.path}" {elseif $current.selected_derivative->is_cached()}src="{$current.selected_derivative->get_url()}"{$current.selected_derivative->get_size_htm()}{else}src="{$ROOT_URL}{$themeconf.img_dir}/ajax_loader.gif" data-src="{$current.selected_derivative->get_url()}"{/if} alt="{$ALT_IMG}" id="theMainImage" usemap="#map{$current.selected_derivative->get_type()}" title="{if isset($COMMENT_IMG)}{$COMMENT_IMG|@strip_tags:false|@replace:'"':' '}{else}{$current.TITLE_ESC} - {$ALT_IMG}{/if}">
|
||||
{if isset($current.path_ext) and $current.path_ext == 'pdf' and $current.filesize < $PDF_VIEWER_FILESIZE_THRESHOLD}
|
||||
<div>
|
||||
<embed src="{$ROOT_URL}{$current.path}" type="application/pdf" />
|
||||
</div>
|
||||
{else}
|
||||
<img class="file-ext-{if isset($current.file_ext)}{$current.file_ext}{/if} path-ext-{if isset($current.path_ext)}{$current.path_ext}{/if}" {if (isset($current.path_ext) and $current.path_ext == 'svg')} src="{$current.path}" {elseif $current.selected_derivative->is_cached()}src="{$current.selected_derivative->get_url()}"{$current.selected_derivative->get_size_htm()}{else}src="{$ROOT_URL}{$themeconf.img_dir}/ajax_loader.gif" data-src="{$current.selected_derivative->get_url()}"{/if} alt="{$ALT_IMG}" id="theMainImage" usemap="#map{$current.selected_derivative->get_type()}" title="{if isset($COMMENT_IMG)}{$COMMENT_IMG|@strip_tags:false|@replace:'"':' '}{else}{$current.TITLE_ESC} - {$ALT_IMG}{/if}">
|
||||
|
||||
{if isset($current.path_ext) and $current.path_ext == 'pdf' and $current.filesize > $PDF_VIEWER_FILESIZE_THRESHOLD}
|
||||
<div class="pdf-too-heavy">
|
||||
{'The PDF you requested is too large to display on this page.'|translate}</br>
|
||||
<a href="{$ROOT_URL}{$current.path}" target="_blank">{'Click here to display it'|translate}</a>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{foreach from=$current.unique_derivatives item=derivative key=derivative_type}{strip}
|
||||
<map name="map{$derivative->get_type()}">
|
||||
|
||||
@@ -414,6 +414,15 @@ TD.calDayCellFull, TD.calDayCellEmpty {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pdf-too-heavy {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.pdf-too-heavy a {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#imageInfos {
|
||||
position: relative; /*for IE7 positioning of "who can see this photo"*/
|
||||
min-height: 120px;
|
||||
|
||||
Reference in New Issue
Block a user