From 50492ade855693c3242764b86f63ab128eff1b32 Mon Sep 17 00:00:00 2001 From: Maloja <14056494+maloja@users.noreply.github.com> Date: Wed, 5 Feb 2020 19:17:18 +0100 Subject: [PATCH] Initial upload --- PicoFotofolder.php | 229 +++++ README.md | 35 + assets/circleplus.png | Bin 0 -> 1631 bytes assets/css/fotofolder.css | 57 ++ composer.json | 26 + images/pico-fotofolder-screenshot.png | Bin 0 -> 559127 bytes vendor/baguettebox/LICENSE | 21 + vendor/baguettebox/README.md | 269 ++++++ vendor/baguettebox/dist/baguetteBox.css | 198 +++++ vendor/baguettebox/dist/baguetteBox.js | 789 ++++++++++++++++++ vendor/baguettebox/dist/baguetteBox.min.css | 6 + vendor/baguettebox/dist/baguetteBox.min.js | 7 + vendor/lazyload/CHANGELOG.md | 496 +++++++++++ vendor/lazyload/LICENSE | 21 + vendor/lazyload/README.md | 658 +++++++++++++++ vendor/lazyload/dist/lazyload.amd.js | 536 ++++++++++++ vendor/lazyload/dist/lazyload.amd.min.js | 2 + vendor/lazyload/dist/lazyload.amd.min.js.map | 1 + vendor/lazyload/dist/lazyload.esm.js | 490 +++++++++++ vendor/lazyload/dist/lazyload.iife.js | 536 ++++++++++++ vendor/lazyload/dist/lazyload.iife.min.js | 2 + vendor/lazyload/dist/lazyload.iife.min.js.map | 1 + vendor/lazyload/dist/lazyload.js | 540 ++++++++++++ vendor/lazyload/dist/lazyload.min.js | 2 + vendor/lazyload/dist/lazyload.min.js.map | 1 + 25 files changed, 4923 insertions(+) create mode 100644 PicoFotofolder.php create mode 100644 README.md create mode 100644 assets/circleplus.png create mode 100644 assets/css/fotofolder.css create mode 100644 composer.json create mode 100644 images/pico-fotofolder-screenshot.png create mode 100644 vendor/baguettebox/LICENSE create mode 100644 vendor/baguettebox/README.md create mode 100644 vendor/baguettebox/dist/baguetteBox.css create mode 100644 vendor/baguettebox/dist/baguetteBox.js create mode 100644 vendor/baguettebox/dist/baguetteBox.min.css create mode 100644 vendor/baguettebox/dist/baguetteBox.min.js create mode 100644 vendor/lazyload/CHANGELOG.md create mode 100644 vendor/lazyload/LICENSE create mode 100644 vendor/lazyload/README.md create mode 100644 vendor/lazyload/dist/lazyload.amd.js create mode 100644 vendor/lazyload/dist/lazyload.amd.min.js create mode 100644 vendor/lazyload/dist/lazyload.amd.min.js.map create mode 100644 vendor/lazyload/dist/lazyload.esm.js create mode 100644 vendor/lazyload/dist/lazyload.iife.js create mode 100644 vendor/lazyload/dist/lazyload.iife.min.js create mode 100644 vendor/lazyload/dist/lazyload.iife.min.js.map create mode 100644 vendor/lazyload/dist/lazyload.js create mode 100644 vendor/lazyload/dist/lazyload.min.js create mode 100644 vendor/lazyload/dist/lazyload.min.js.map diff --git a/PicoFotofolder.php b/PicoFotofolder.php new file mode 100644 index 0000000..c9d9505 --- /dev/null +++ b/PicoFotofolder.php @@ -0,0 +1,229 @@ +\s*\(%\s+' . $this->p_keyword .'\s*\(\s*(.*?)\s*\)\s+%\)\s*<\/p>/', function($match) { + + if ($match[1]) { + list ($this->image_src['path'], + $this->image_src['sort'], + $this->image_src['order']) = explode(',', str_replace('"', '', $match[1])); + + $this->image_src['path'] = trim($this->image_src['path']); + $this->image_src['sort'] = trim($this->image_src['sort']); + $this->image_src['order'] = trim($this->image_src['order']); + if ($this->image_src['sort'] == "") $this->image_src['sort'] = 'name'; + if ($this->image_src['order'] == "") $this->image_src['order'] = 'dsc'; + + $img_metas = $this->readMetaArray(); + + if (count($img_metas) > 0) { + $out = $this->createOutput($img_metas); + $this->p_count++; + } + } + return $out; + }, $content); + } + + + /** + * Triggered after Pico has rendered the page + */ + public function onPageRendered(&$output ) { + // add required elements in head tag + if ($this->p_count > 0) { + $jsh = ' ' . "\n"; + $jsh .= ' ' . "\n"; + $jsh .= ' ' . "\n"; + $jsh .= ' ' . "\n"; + $jsh .= ' ' . "\n"; + $jsh .= '' . "\n" . '
' . "\n"; + $output = preg_replace('/\\<\\/head\\>\s*\n\s*\\/', $jsh, $output, 1); + + // Add LazyLoad + $jsh = '' . "\n"; + $jsh .= '' . "\n" . '' . "\n"; + $output = preg_replace('/\\<\\/body\\>\s*\n\s*\\<\/html\\>/', $jsh, $output, 1); + } + } + + + /*************************************************************** + * Private Functions + */ + + /***************************************************************/ + private function readMetaArray() { + $dir = $_SERVER['DOCUMENT_ROOT'] . $this->image_src['path']; + $img_metas = array(); + $pattern = '{,.}*.{[jJ][pP][gG],[jJ][pP][eE][gG],[pP][nN][gG],[gG][iI][fF],dat}'; + $filelist = glob($dir . '/' . $pattern, GLOB_BRACE); + usort($filelist, create_function('$a,$b', 'return filemtime($b) - filemtime($a);')); + + //check if metafile is still up to date or if we have to create a new one + if (strpos($filelist[0], '.fotofolder.dat') == true) { + $string_data = file_get_contents($filelist[0]); + $img_metas = unserialize($string_data); + } + //ok recreate it + else { + foreach ($filelist as $img) { + if (strpos($img, '.fotofolder.dat') == false) { + list($width, $height, $type, $attr) = getimagesize($img); + $exif = (exif_read_data($img, 0, true)); + $url = str_replace($_SERVER['DOCUMENT_ROOT'], '', $img); + $img_name = pathinfo($img, PATHINFO_BASENAME); + + // handle thumbnails + if (!file_exists( $_SERVER['DOCUMENT_ROOT'] . $this->image_src['path'] . '/thumbnails' )) { + mkdir( $_SERVER['DOCUMENT_ROOT'] . $this->image_src['path'] . '/thumbnails', 0777, true); + } + $thumb_name = $_SERVER['DOCUMENT_ROOT'] . $this->image_src['path'] . '/thumbnails/thumb_' . $img_name; + if ( !file_exists($thumb_name) ) { + $this->scaleImageCopy($img, $thumb_name, 300, 300); + } + elseif ( filemtime($thumb_name) < filemtime($img) ) { + $this->scaleImageCopy($img, $thumb_name, 300, 300); + } + if ($width > $height) $format = 'landscape'; + if ($width < $height) $format = 'portrait'; + if ( abs( 1 - $width / $height) > 0.8 ) $format = 'square'; + + + $thumb_date = filemtime($thumb_name); + $thumb_url = $this->image_src['path'] . '/thumbnails/thumb_' . $img_name; + + array_push( $img_metas, array( 'filename' => $img, + 'url' => $url, + 'imgname' => $img_name, + 'date' => $exif['FILE']['FileDateTime'], + 'width' => $width, + 'height' => $height, + 'type' => $type, + 'attr' => $attr, + 'format' => $format, + 'thumb_url' => $thumb_url, + 'thumb_date' => $thumb_date )); + + } + } + $string_data = serialize($img_metas); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . $this->image_src['path'] . '/.fotofolder.dat', $string_data); + } + return($img_metas); + } + + /***************************************************************/ + private function createOutput($img_metas) { + + if ( $image_src['order'] == 'asc') { + usort($img_metas, function($a, $b) { + return $a[$this->image_src['sort']] <=> $b[$this->image_src['sort']]; + }); + } + else { + usort($img_metas, function($a, $b) { + return $b[$this->image_src['sort']] <=> $a[$this->image_src['sort']]; + }); + } + + $out = 'LO4eGf+1Gx
zc!`O8nbfu|%iL7W;Xo+qq=ar=j6GsK^IaSf1RQo-S0_ft1jBkMOWO3C1Oldn jT`fYX_EF){r>RuER+-{845_6ByZlPx-RRH}sfK73jRu%BM%Yn!#ILW*2$%tXulWqnoK
z+IMw2O_L?VH)ld7(XEPfwS(R2ta*h2`Njuogk9`G%1v{M_H
z+jXCdj-UeB$mh?tyXL|#`lo&NOcrdF
zqgzAes=X!W2qiqOGH?4{ROIGa)W1#~wH1D0C&i>ahk59qH>14z2l}+Q;aQ4!)GM3i
z?-YY$|ESB3ASJbT6disIM`w`QFM{U>y$33;ny`hL%x88|&b0h{FRh*Hq^w(8^RmV(
zNQ$imMQf8p^HivTtSE2=;#c1XXTQi*cS;Z^(U8{AgZ*Br?!{U>YXX&^@;hluubbIL
zl||GoSt|~6)eOR%%Jz;hjZM~$7-77s55v8CqV=c-t!
z#SSQ|P|h8$cMLBix)4GPZ;-Q5c>TT$$1X&f*VVQ;xGtYxlqt|KqTtX`keDjLNc?AO6H3fCz#_J$~v=d!|u2V#Mv%FjUF1&Hf90X
zlTjCS|4r)&k3sC(m|m2#f3^#EAYi^Si!`CuJYXeK_BnhCRZH+XoQpJl%0j@2d^JT1
zRbgo2N;un+N+rg#PC)(CeX7U0JhsHZK2bE0HuQ$^VS>;gH#brt#+8_kK;uu>DBvu2
zEIPzbP^_7{!q$7;F~J>%UQ|X#mut1*(D+HXm~s}iN|-wmjiq0TyOIT=1q>%LbY(P4
zVXnfU!f0neB9ko4BYo>Qi~OvHwq!)-eBUbIQ;=)x*UfFY^Azn{L|WVoLQsx()emuF
z9u+Fvw1+_eNge*%zT)zeSJqLK_>D>M(O2AQR-(Vz8iI%aa|>R)_j7tF+0xO32YxaO
z{z5Qzn3UDq)J0FK&pW}a2cnZgNqHJFYnsdP4o}Hq