first commit
This commit is contained in:
commit
f655e84081
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2018 Neo-Inspiration
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
namespace ImageGallery;
|
||||
|
||||
use Omeka\Module\AbstractModule;
|
||||
use Laminas\EventManager\SharedEventManagerInterface;
|
||||
use Laminas\Mvc\MvcEvent;
|
||||
|
||||
class Module extends AbstractModule
|
||||
{
|
||||
const NAMESPACE = __NAMESPACE__;
|
||||
|
||||
const IMAGE_WIDTH = [
|
||||
'25' => '25 %',
|
||||
'50' => '50 %',
|
||||
'75' => '75 %',
|
||||
'100' => '100 %',
|
||||
];
|
||||
|
||||
public function getConfig()
|
||||
{
|
||||
return include __DIR__ . '/config/module.config.php';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
# ImageGallery media for Omeka S
|
||||
|
||||
[ImageGallery] is a module for [Omeka S] that optionally enables [wheelzoom],
|
||||
a script for zooming IMG elements with the mousewheel/trackpad and [zoom],
|
||||
a script to enlarge images on touch, click, or mouseover.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
cd ./modules
|
||||
https://git.hangar.org/arcHIVE-tech/ImageGallery/archive/main.zip
|
||||
unzip main.zip
|
||||
mv imageviewer-omeka-module/ ImageGallery
|
||||
rm main.zip
|
||||
```
|
||||
|
||||
## LISENCE
|
||||
The module is released under the [MIT] License.
|
||||
|
||||
[arc-hive]: https://arc-hive.zone/
|
||||
[wheelzoom]: https://github.com/jackmoore/wheelzoom
|
||||
[zoom]: https://github.com/jackmoore/zoom
|
||||
[Omeka S]: https://omeka.org/s
|
||||
[ImageGallery]: https://git.hangar.org/arcHIVE-tech/ImageGallery
|
||||
[MIT]: http://opensource.org/licenses/MIT
|
|
@ -0,0 +1,52 @@
|
|||
.archive-gallery * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.archive-gallery .source-link {
|
||||
display: flex;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.archive-gallery img {
|
||||
max-width: 100%;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.archive-gallery .gallery {
|
||||
display: flex;
|
||||
/*margin: 10px auto;*/
|
||||
margin: 0 auto;
|
||||
max-width: 600px;
|
||||
position: relative;
|
||||
/*padding-top: 66.6666666667%;*/
|
||||
}
|
||||
/*
|
||||
.archive-gallery @media screen and (min-width: 600px) {
|
||||
.gallery {
|
||||
padding-top: 400px;
|
||||
}
|
||||
}
|
||||
*/
|
||||
.archive-gallery .gallery__img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease-in-out;
|
||||
}
|
||||
.archive-gallery .gallery__thumb {
|
||||
padding-top: 6px;
|
||||
margin: 6px;
|
||||
display: block;
|
||||
}
|
||||
.archive-gallery .gallery__selector {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
.archive-gallery .gallery__selector:checked + .gallery__img {
|
||||
opacity: 1;
|
||||
}
|
||||
.archive-gallery .gallery__selector:checked ~ .gallery__thumb > img {
|
||||
box-shadow: 0 0 0 3px #0be2f6;
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
namespace ImageGallery;
|
||||
|
||||
return [
|
||||
'view_manager' => [
|
||||
'template_path_stack' => [
|
||||
dirname(__DIR__) . '/view',
|
||||
]
|
||||
],
|
||||
'block_layouts' => [
|
||||
'factories' => [
|
||||
'imageGallery' => Service\BlockLayout\ImageGalleryFactory::class,
|
||||
],
|
||||
],
|
||||
'form_elements' => [
|
||||
'invokables' => [
|
||||
Form\ImageGalleryBlockForm::class => Form\ImageGalleryBlockForm::class,
|
||||
],
|
||||
],
|
||||
'DefaultSettings' => [
|
||||
'ImageGalleryBlockForm' => [
|
||||
'title' => '',
|
||||
'renderSourceLink' => true,
|
||||
'width' => 600,
|
||||
'wrapStyle' => 'overflow-y: hidden;display: flex;flex-direction: column;justify-content: center;',
|
||||
]
|
||||
]
|
||||
];
|
|
@ -0,0 +1,12 @@
|
|||
[info]
|
||||
name = "Image gallery"
|
||||
description = "A pure CSS image gallery"
|
||||
tags = ""
|
||||
license = "MIT"
|
||||
author = "Hangar.org"
|
||||
author_link = "https://git.hangar.org/chris"
|
||||
module_link = "https://git.hangar.org/arcHIVE-tech/ImageGallery"
|
||||
support_link = "https://git.hangar.org/arcHIVE-tech/ImageGallery/issues"
|
||||
configurable = false
|
||||
version = "1.0.0"
|
||||
omeka_version_constraint = "^3.0.1"
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
namespace ImageGallery\Form;
|
||||
|
||||
use ImageGallery\Module;
|
||||
use Laminas\Form\Element;
|
||||
use Laminas\Form\Form;
|
||||
|
||||
class ImageGalleryBlockForm extends Form
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
|
||||
$this->add([
|
||||
'name' => 'o:block[__blockIndex__][o:data][width]',
|
||||
'type' => Element\Select::class,
|
||||
'options' => [
|
||||
'label' => 'Width',
|
||||
'value_options' => Module::IMAGE_WIDTH,
|
||||
],
|
||||
]);
|
||||
|
||||
$this->add([
|
||||
'type' => Element\Checkbox::class,
|
||||
'name' => 'o:block[__blockIndex__][o:data][renderSourceLink]',
|
||||
'options' => [
|
||||
'label' => 'Display a link to the item',
|
||||
//'use_hidden_element' => true,
|
||||
'checked_value' => true,
|
||||
'unchecked_value' => false,
|
||||
],
|
||||
]);
|
||||
|
||||
$this->add([
|
||||
'name' => 'o:block[__blockIndex__][o:data][title]',
|
||||
'type' => Element\Text::class,
|
||||
'options' => [
|
||||
'label' => 'Sub-title',
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
namespace ImageGallery\Service\BlockLayout;
|
||||
|
||||
use Interop\Container\ContainerInterface;
|
||||
use ImageGallery\Site\BlockLayout\ImageGallery;
|
||||
use Laminas\ServiceManager\Factory\FactoryInterface;
|
||||
|
||||
class ImageGalleryFactory implements FactoryInterface
|
||||
{
|
||||
public function __invoke(ContainerInterface $services, $requestedName, array $options = null)
|
||||
{
|
||||
return new ImageGallery(
|
||||
$services->get('FormElementManager'),
|
||||
$services->get('Config')['DefaultSettings']['ImageGalleryBlockForm']
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
namespace ImageGallery\Site\BlockLayout;
|
||||
|
||||
use Omeka\Api\Representation\SiteRepresentation;
|
||||
use Omeka\Api\Representation\SitePageRepresentation;
|
||||
use Omeka\Api\Representation\SitePageBlockRepresentation;
|
||||
use Omeka\Site\BlockLayout\AbstractBlockLayout;
|
||||
use Laminas\View\Renderer\PhpRenderer;
|
||||
|
||||
use Laminas\Form\FormElementManager;
|
||||
|
||||
use ImageGallery\Form\ImageGalleryBlockForm;
|
||||
|
||||
class ImageGallery extends AbstractBlockLayout
|
||||
{
|
||||
/**
|
||||
* @var FormElementManager
|
||||
*/
|
||||
protected $formElementManager;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $defaultSettings = [];
|
||||
|
||||
/**
|
||||
* @param FormElementManager $formElementManager
|
||||
* @param array $defaultSettings
|
||||
*/
|
||||
public function __construct(FormElementManager $formElementManager, array $defaultSettings)
|
||||
{
|
||||
$this->formElementManager = $formElementManager;
|
||||
$this->defaultSettings = $defaultSettings;
|
||||
}
|
||||
|
||||
public function getLabel() {
|
||||
return 'Image gallery';
|
||||
}
|
||||
|
||||
public function form(PhpRenderer $view,
|
||||
SiteRepresentation $site,
|
||||
SitePageRepresentation $page = null,
|
||||
SitePageBlockRepresentation $block = null
|
||||
) {
|
||||
$form = $this->formElementManager->get(ImageGalleryBlockForm::class);
|
||||
$data = $block
|
||||
? $block->data() + $this->defaultSettings
|
||||
: $this->defaultSettings;
|
||||
$form->setData([
|
||||
'o:block[__blockIndex__][o:data][title]' => $data['title'],
|
||||
'o:block[__blockIndex__][o:data][width]' => $data['width'],
|
||||
'o:block[__blockIndex__][o:data][renderSourceLink]' => $data['renderSourceLink'],
|
||||
]);
|
||||
$form->prepare();
|
||||
|
||||
$html = '';
|
||||
$html .= $view->blockAttachmentsForm($block);
|
||||
$html .= '<a href="#" class="collapse" aria-label="collapse"><h4>';
|
||||
$html .= $view->translate('Options'). '</h4></a>';
|
||||
$html .= '<div class="collapsible" style="padding-top:6px;">';
|
||||
$html .= $view->formCollection($form);
|
||||
$html .= '</div>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function render(PhpRenderer $view, SitePageBlockRepresentation $block)
|
||||
{
|
||||
$attachments = $block->attachments();
|
||||
if (!$attachments) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$thumbnails = [];
|
||||
static $id = 0;
|
||||
|
||||
$media = $attachments[0]->item()->media()[0];
|
||||
$item = $attachments[0]->item();
|
||||
return $view->partial('common/block-layout/imageGallery', [
|
||||
'title' => $block->dataValue('title'),
|
||||
'item' => $item,
|
||||
'images' => $item->media(),
|
||||
'item_url' => $attachments[0]->item()->url(),
|
||||
'renderSourceLink' => $block->dataValue('renderSourceLink'),
|
||||
'width' => $block->dataValue('width'),
|
||||
'image' => $media->primaryMedia()->thumbnailUrl('large'),
|
||||
'gallery_id' => 'ig-' . ++$id,
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
|
||||
<?php
|
||||
$this->headLink()->appendStylesheet($this->assetUrl('css/gallery.css', 'ImageGallery'));
|
||||
?>
|
||||
|
||||
<?php $image_id = 0; ?>
|
||||
|
||||
|
||||
<div class="archive-gallery">
|
||||
<?php if ($renderSourceLink) { ?>
|
||||
<div class="source-link">
|
||||
<a href="<?= $item_url ?>">Source</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<section id="<?= $gallery_id ?>"
|
||||
class="gallery" style="padding-top: 330px;">
|
||||
|
||||
<?php foreach ($images as $image) { ?>
|
||||
<?php $image_id = $image_id +1;
|
||||
$img_id = $gallery_id . '-' . $image_id;
|
||||
?>
|
||||
<div class="gallery__item">
|
||||
<input type="radio"
|
||||
id="<?= $img_id ?>"
|
||||
checked name="gallery"
|
||||
class="gallery__selector"/>
|
||||
<img class="gallery__img"
|
||||
style="height: 330px;"
|
||||
src="<?= $image->primaryMedia()->thumbnailUrl('large') ?>"
|
||||
alt=""
|
||||
/>
|
||||
<label for="<?= $img_id ?>" class="gallery__thumb">
|
||||
<img src="<?= $image->primaryMedia()->thumbnailUrl('large') ?>"
|
||||
alt=""
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</section>
|
||||
</div>
|
Loading…
Reference in New Issue