- description zu den seiten hinzugefügt - square7 etwas entfernt - update pandoc: version 2.13 benötigt
278 lines
8.3 KiB
PHP
278 lines
8.3 KiB
PHP
<?php
|
||
$basePath = "/users/cwsvjudo/www";
|
||
require_once($basePath."/config/phpcount.config.php");
|
||
require_once($basePath."/config/cwsvJudo.config.php");
|
||
require_once($basePath."/ressourcen/phpLib/phpcount/phpcount.php");
|
||
|
||
$vidGalData = load_vidGal();
|
||
|
||
/// Laden der Daten der Videogalerie aus einer json
|
||
function load_vidGal($filename = "vidGalData.json", $legacyPhpConfigFileName = "config.inc.php"){
|
||
// Initialisieren des Rückgabewertes
|
||
$vidGalData = [
|
||
'name' => "fehlender Name",
|
||
'date' => "0000-00-00",
|
||
'vidList' => []
|
||
];
|
||
// Laden aus einer config, legacy
|
||
if( file_exists( $legacyPhpConfigFileName ) ){
|
||
include( $legacyPhpConfigFileName );
|
||
if($wkName)
|
||
$vidGalData["name"] = $wkName;
|
||
if($wkDatum)
|
||
$vidGalData["date"] = $wkDatum;
|
||
}
|
||
// laden aus einer json
|
||
if( file_exists( $filename ) ){
|
||
$jsonString = file_get_contents( $filename);
|
||
$jsonData = json_decode($jsonString, true);
|
||
if($jsonData)
|
||
$vidGalData = $jsonData;
|
||
}
|
||
// falls die vidList jetzt immer noch leer ist, wird nach Videodatein gescannt
|
||
if(empty($vidGalData['vidList'])){
|
||
$vidGalData['vidList'] = vidScan();
|
||
file_put_contents($filename, json_encode($vidGalData, JSON_PRETTY_PRINT));
|
||
}
|
||
return $vidGalData;
|
||
}
|
||
|
||
/// Scanning for Videos
|
||
function vidScan( $fmtList = array("webm", "mp4") ){
|
||
$vidList = [];
|
||
foreach( $fmtList as $fmt ){
|
||
foreach( glob("./".$fmt."/*.".$fmt) as $vid){
|
||
$posterSrc = str_replace( ".".$fmt, ".jpg", # Endung ersetzten, ...
|
||
str_replace($fmt."/", "thumbnails/", $vid ) ); # nachdem wir das Verzeichnis anpassten
|
||
$posterSize = getimagesize( $posterSrc );
|
||
$vidList[] = array(
|
||
'vidSrc' => $vid,
|
||
'vidFmt' => $fmt,
|
||
'posterSrc' => $posterSrc,
|
||
'width' => $posterSize[0],
|
||
'height' => $posterSize[1]
|
||
);
|
||
}
|
||
}
|
||
return $vidList;
|
||
}
|
||
|
||
/// Hilfsfunktion zum Anpassen der htmlDescription
|
||
function descrName($aName){
|
||
$retVal = "Videos der Judoka des Chemnitzer WSV beim Wettkampf ".$aName;
|
||
if( strpos($aName, "Sommerabschlussgrillen") >= 0 ) $retVal = "Videos der Judoka des Chemnitzer WSV beim ".$aName;
|
||
if( strpos($aName, "Jahrendefeier") >= 0 ) $retVal = "Videos der Judoka des Chemnitzer WSV bei der ".$aName;
|
||
return $retVal;
|
||
}/// Ende descrName
|
||
|
||
$messages = array();
|
||
?>
|
||
<!DOCTYPE HTML>
|
||
<html lang="de">
|
||
<head>
|
||
<title><?php echo( $vidGalData['name'] );?> - Videoalbum</title>
|
||
<?php PHPCount::AddHit($vidGalData['name'] ." - Videoalbum");?>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||
<meta name="description" content="<?php echo descrName($vidGalData['name'] );?>">
|
||
<meta name="keywords" content="Album, Videos">
|
||
<!-- BluimpGallery Zeug -->
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<link rel="stylesheet" href="/ressourcen/blueimpGallery/css/blueimp-gallery.css">
|
||
<link rel="stylesheet" href="/ressourcen/blueimpGallery/css/blueimp-gallery-indicator.css">
|
||
<link rel="stylesheet" href="/ressourcen/blueimpGallery/css/blueimp-gallery-video.css">
|
||
|
||
<!-- favIcon und Co nach der empfehlung von https://github.com/audreyr/favicon-cheat-sheet -->
|
||
<?php require_once($basePath."/pages/shared/favicon.html.inc");?>
|
||
<link rel="shortcut icon" type="image/x-icon" sizes="16x16 32x32 48x48 64x64" href="/ressourcen/graphiken/logos/favicon/favicon.ico">
|
||
<link rel="manifest" href="/manifest.json">
|
||
<link rel="canonical" href="http://cwsvjudo.bplaced.net<?php echo $_SERVER['REQUEST_URI']?>" />
|
||
|
||
<script type="text/javascript" src="/ressourcen/blueimpGallery/js/blueimp-gallery.min.js" async=""></script>
|
||
<!--https://github.com/aFarkas/lazysizes-->
|
||
<script src="/ressourcen/jsLib/lazysizes.min.js" async=""></script>
|
||
<style>
|
||
.no-js img.lazyload {
|
||
display: none;
|
||
}
|
||
</style>
|
||
<noscript><style>
|
||
img.lazyload {
|
||
display: none;
|
||
}
|
||
</style></noscript>
|
||
|
||
<style>
|
||
body{box-sizing: border-box; margin: 0;}
|
||
.smallFont{font-size: small;}
|
||
.centerText{text-align: center;}
|
||
.navButton{
|
||
box-sizing: border-box;
|
||
border-color: white;
|
||
border-style: outset;
|
||
border-radius: 1em;
|
||
text-align: center;
|
||
text-decoration: none;
|
||
cursor: pointer;
|
||
display: inline-block;
|
||
padding-left: .5em;
|
||
padding-right: .5em;
|
||
padding: 0;
|
||
margin: 0;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body style="color: #000000; background-color: #FFAE00" >
|
||
<a title="Galerien der Judoka des Chemnitzer WSV" href="/galerien">Zur Galerieübersicht</a>
|
||
<?php
|
||
/// Eine kleine Messagebox
|
||
if( !empty($messages) ){
|
||
?>
|
||
<div style="border: 1px solid black">
|
||
<?php
|
||
if( !empty( $messages['info'] ) ) echo( $messages['info'] );
|
||
?>
|
||
</div>
|
||
<?php
|
||
}
|
||
?>
|
||
|
||
<h1 class="centerText" >
|
||
<?php echo($vidGalData['name'] );?> - Videoalbum
|
||
</h1>
|
||
|
||
<p class="centerText smallFont">
|
||
[<?php echo count($vidGalData['vidList'])?> Videos]
|
||
</p>
|
||
|
||
<p class="centerText smallFont">
|
||
Auf die jeweiligen Bilder klicken um das Video anzuwählen.
|
||
</p>
|
||
|
||
<hr/>
|
||
|
||
<style type="text/css">
|
||
body{
|
||
margin: 0;
|
||
}
|
||
.galImgList{
|
||
font-size: 0;
|
||
display: flex;
|
||
flex-flow: row wrap;
|
||
justify-content: center;
|
||
align-items: center;
|
||
margin: 0;
|
||
padding: 0;
|
||
}
|
||
.galImgList div{
|
||
flex: auto;
|
||
width: 100%;
|
||
padding: 1vw 0;
|
||
flex-grow: unset;
|
||
}
|
||
.galImgList div img{
|
||
width: 100%;
|
||
height: auto;
|
||
}
|
||
.galImgList div video{
|
||
width: 100%;
|
||
height: auto;
|
||
}
|
||
@media screen and (min-width: 768px) {
|
||
.galImgList div{
|
||
width: calc(100% * (1/3) - 2 * .5vw);
|
||
margin: .5vw;
|
||
}
|
||
.galImgList{
|
||
padding: .5vw;
|
||
}
|
||
}
|
||
@media screen and (min-width: 1024px) {
|
||
.galImgList div{
|
||
width: calc(100% * (1/4) - 2 * 1vw);
|
||
margin: 1vw;
|
||
}
|
||
.galImgList{
|
||
padding: 1vw;
|
||
}
|
||
}
|
||
</style>
|
||
|
||
<div id="links" class="galImgList">
|
||
<?php
|
||
foreach( $vidGalData['vidList'] as $vidKey => $vidEntry ){
|
||
echo( "<div>" );
|
||
echo "<img class=\"lazyload\" ".
|
||
// Wir haben unsere eigen noscript-Alternative (die kein img mehr
|
||
// ist!), deshalb brauchen wir diesen empfohlenen Fallback nicht!
|
||
// "src=\"".$vidEntry['posterSrc']."\"".
|
||
// "srcset=\"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\"".
|
||
"id=\"Video".( $vidKey )."\" ".
|
||
"data-src=\"".( $vidEntry['posterSrc'] )."\" ".
|
||
"width=\"".$vidEntry['width']."\" ".
|
||
"height=\"".$vidEntry['height']."\" ".
|
||
"alt=\"[".( $vidKey + 1 )."/".( count($vidGalData['vidList']) )."]\" ".
|
||
"title=\"".( $vidGalData['name'] )." Video ".( $vidKey + 1 )." von ".( count($vidGalData['vidList']) )."\" ".
|
||
"onclick=\"startGalleryShow(" . $vidKey . ");\"".
|
||
" />";
|
||
echo(
|
||
"<noscript>".
|
||
"<video controls preload=\"none\" poster=\"".$vidEntry['posterSrc']."\" width=\"".$vidEntry['width']."\" height=\"".$vidEntry['height']."\">".
|
||
# "<source src=\"".$vidEntry['vidSrc']."\" type=\"video/webm\">".
|
||
# "<source src=\"".$vidEntry['vidSrc']."\" type=\"video/mp4\">".
|
||
"<source src=\"".$vidEntry['vidSrc']."\" type=\"video\">".
|
||
"Dieser Browser scheint das Video nicht abspielen zu können.".
|
||
"</video>".
|
||
"</noscript>"
|
||
);
|
||
echo("</div>");
|
||
}
|
||
?>
|
||
</div><!-- Ende galImgList -->
|
||
|
||
<!-- BluimpGalerry Lightbox Version -->
|
||
<!-- The Gallery as lightbox dialog, should be a child element of the document body -->
|
||
<div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls">
|
||
<div class="slides"></div>
|
||
<h2 class="title"><?php echo $vidGalData['name'] ?></h2>
|
||
<a class="prev">‹</a>
|
||
<a class="next">›</a>
|
||
<a class="close">×</a>
|
||
<a class="play-pause"></a>
|
||
<ol class="indicator"></ol>
|
||
</div>
|
||
<script>
|
||
function startGalleryShow(startIndex = 0){
|
||
var videoList = [
|
||
<?php
|
||
foreach( $vidGalData['vidList'] as $vidEntry){
|
||
echo "{href: '".$vidEntry['vidSrc']."', poster: '".$vidEntry['posterSrc']."', type: 'video/".$vidEntry['vidFmt']."'},";
|
||
}
|
||
?>
|
||
];
|
||
var gallery = blueimp.Gallery(
|
||
videoList,
|
||
{
|
||
onslide: function (index, slide) {
|
||
var pageUrl = encodeURIComponent( window.location.href ) + "?index=" + index.toString();
|
||
var pageTitle = document.title + " [" + index.toString() + "]";
|
||
|
||
var xmlHttp = new XMLHttpRequest();
|
||
xmlHttp.open("GET", callUrl, true); // true for asynchronous
|
||
xmlHttp.send(null);
|
||
},
|
||
startSlideshow: true,
|
||
stretchImages: true,
|
||
index: startIndex,
|
||
}
|
||
);
|
||
};
|
||
|
||
window.onload = function () {
|
||
startGalleryShow();
|
||
};
|
||
// startGalleryShow();
|
||
</script>
|
||
<hr/>
|
||
</body>
|
||
</html>
|