Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion classes/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class Image
{
public const IMG_REGEX = '/\.(jpe?g|gif|png|svg|webp)$/i';
public const IMG_REGEX = '/\.(jpe?g|gif|png|svg|webpi|mp4)$/i';

protected $isExternal = false;
protected $src;
Expand All @@ -19,6 +19,7 @@ class Image
protected $created = 0;
protected $modified = 0;
protected $detaillink;
public $imagetype;


/**
Expand All @@ -45,6 +46,8 @@ public function __construct($src)
$this->width = $jpegMeta->getField('File.Width');
$this->height = $jpegMeta->getField('File.Height');
}
if (preg_match(self::IMG_REGEX, $this->filename, $match))
$this->imagetype = $match[1];
}

public function isExternal()
Expand Down
11 changes: 7 additions & 4 deletions classes/XHTMLFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,13 @@ protected function renderImage(Image $image)
}

$html = '<figure ' . buildAttributes($fig, true) . '>';
$html .= '<a ' . buildAttributes($a, true) . '>';
$html .= '<img ' . buildAttributes($img, true) . ' />';
$html .= '</a>';

if ($image->imagetype == 'mp4'){
$html .= str_replace('width="320" height="240"','',$this->renderer->_video($image->getSrc(),320,240,$a));
} else {
$html .= '<a ' . buildAttributes($a, true) . '>';
$html .= '<img ' . buildAttributes($img, true) . ' />';
$html .= '</a>';
}
if ($this->options->showtitle || $this->options->showname) {
$html .= '<figcaption>';
if ($this->options->showtitle) {
Expand Down
7 changes: 4 additions & 3 deletions screen.less
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ div.plugin-gallery {
justify-content: space-between;
overflow: hidden;

img {
max-width: 100%;
height: auto;
img, video {
aspect-ratio: 1/1;
object-fit: cover;
width: 100%;
}

figcaption {
Expand Down
5 changes: 3 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jQuery(function () {
/**
* Initialize the lightbox
*/
new SimpleLightbox("a.lightbox, a[rel^='lightbox']", {
new SimpleLightbox(".lightbox, [rel^='lightbox']", {
sourceAttr: 'data-url',
captionSelector: 'self',
captionType: 'data',
Expand All @@ -67,7 +67,8 @@ jQuery(function () {
captionHTML: true, // we allow HTML and double escape in the formatter
alertError: false,
fileExt: false,
uniqueImages: false
uniqueImages: false,
widthRatio: 1.0
});
});

Loading