Add link to external version of the source image

This commit is contained in:
Olivier Berten 2021-02-21 19:20:18 +01:00
parent e6362d9c01
commit d57c33c255
3 changed files with 18 additions and 7 deletions

View File

@ -128,6 +128,7 @@ if(count($c_p) > 0) {
$cnt = 1;
foreach($c_p as $s) {
$source_label = "<i>".$sources[$s[0]]['title'].", ".$sources[$s[0]]['editor'].", ".($sources[$s[0]]['period']?$sources[$s[0]]['period']:$sources[$s[0]]['year'])."</i>".($s[1]>''?", p. ".$s[1]:'');
$urls = $sources[$s[0]]['urls'];
if (count($s) > 2) {
echo '<li><a href="#source_'.$cnt.'">'.$source_label."</a></li>\n";
$sources_img .= '<p><a name="source_'.$cnt.'">'.$source_label."</a> &nbsp;";
@ -173,7 +174,10 @@ if(count($c_p) > 0) {
if($next) $sources_img .= ' <a class="prevnext" href="chant.php?id='.$next[0].'" title="Next chant in this source" >▶</a>';
$sources_img .= "<br />\n";
for($i = 0; $i < max(1, $s[3]); $i++) {
$sources_img .= '<img src="sources/'.$s[0].'/'.($s[2]+$i).'.png" alt="" /><br />'."\n";
if(is_array($urls)) $sources_img .= '<a target="_new" href="'.$urls[0].$urls[1][$i].$urls[2].'">';
$sources_img .= '<img src="sources/'.$s[0].'/'.($s[2]+$i).'.png" alt="" />';
if(is_array($urls)) $sources_img .= '</a>';
$sources_img .= '<br />'."\n";
}
$sources_img .= "</p>\n<hr />\n";
} else {

View File

@ -1,11 +1,11 @@
-- phpMyAdmin SQL Dump
-- version 5.1.0-rc1
-- version 5.1.0-rc2
-- https://www.phpmyadmin.net/
--
-- Hôte : localhost
-- Généré le : jeu. 11 fév. 2021 à 22:29
-- Généré le : dim. 21 fév. 2021 à 19:10
-- Version du serveur : 10.4.17-MariaDB-1:10.4.17+maria~xenial
-- Version de PHP : 7.4.14
-- Version de PHP : 7.4.15
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
@ -66,7 +66,8 @@ CREATE TABLE `gregobase_chants` (
`gabc` text COLLATE utf8_unicode_ci DEFAULT NULL,
`gabc_verses` text COLLATE utf8_unicode_ci DEFAULT NULL,
`tex_verses` text COLLATE utf8_unicode_ci DEFAULT NULL,
`remarks` text COLLATE utf8_unicode_ci DEFAULT NULL
`remarks` text COLLATE utf8_unicode_ci DEFAULT NULL,
`copyrighted` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
@ -138,7 +139,8 @@ CREATE TABLE `gregobase_sources` (
`title` varchar(256) COLLATE utf8_unicode_ci NOT NULL,
`description` text COLLATE utf8_unicode_ci NOT NULL,
`caption` text COLLATE utf8_unicode_ci NOT NULL,
`pages` mediumtext COLLATE utf8_unicode_ci DEFAULT NULL
`pages` mediumtext COLLATE utf8_unicode_ci DEFAULT NULL,
`urls` text COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------

View File

@ -31,6 +31,7 @@ echo "<h2>$title</h2>\n";
if(array_key_exists('images', $_GET) && $_GET['images'] == '1') {
$ipp = 25;
if(is_array($sources[$s]['pages'])) {
$urls = $sources[$s]['urls'];
$np = count($sources[$s]['pages']);
$start = array_key_exists('index', $_GET) ? intval($_GET['index']*$ipp) : 0;
if($start > $np) $start = 0;
@ -64,7 +65,11 @@ if(array_key_exists('images', $_GET) && $_GET['images'] == '1') {
echo "</ul>\n";
echo "</td>\n";
if(is_dir('./sources/'.$s)) {
echo '<td><img src="sources/'.$s.'/'.$i.'.png" /></td>';
echo '<td>';
if(is_array($urls)) echo '<a target="_new" href="'.$urls[0].$urls[1][$i].$urls[2].'">';
echo '<img src="sources/'.$s.'/'.$i.'.png" />';
if(is_array($urls)) echo '</a>';
echo '</td>';
}
}
echo "</table>\n";