Disclaimer: This extension has forked from the-turk/flarum-ext-fancybox
- Based on fancyBox v3.
- Clicking on an image in a post launches the fancyBox modal. This allows users to zoom in on the image, pan around, and navigate among multiple images, videos or iframes on the same post as a gallery.
- Images are displayed with formatting to normalize sizes and layout.
- If the author of the post has wrapped the image in a link, it will be shown as an external link. (Clicking on the image will not launch the fancyBox modal in this case.)
- Image or URL titles are considered as captions.
Note: This extension does not generate thumbnails. The storage location of images, and the file size / bandwidth usage are not affected.
- This package conflicts with
squeevee/flarum-ext-fancybox
andthe-turk/flarum-ext-fancybox
, so you need to remove them first. - It seems like this package is not compatible with
reflar/recache
(see #4).
composer require malago/flarum-ext-fancybox
composer update malago/flarum-ext-fancybox
php flarum cache:clear
Enable the extension.
Image layouts can be controlled by the formatting of the post's markup (e.g., its BBCode or Markdown).
An image is "stand-alone" if it is not in a paragraph with any text or other images, i.e., it is separated from text or other images by at least two returns. A stand-alone image is displayed in large format.
An image is "inline" if it is in a paragraph with text or other images. An inline image is displayed in small format, in order to fit into the flow of text.
(For technical reasons, an image is considered inline if it is separated from text or another image by only one return.)
If you have the flarum/bbcode
extension, you can use [img fancy=off][/img]
to prevent images from formatting by this extension. This will also exclude them from the fancyBox gallery of the post.
As mentioned under Features, if an image is wrapped in a link, its behavior and appearance are altered. Most notably, in order to preserve the link, clicking on the image opens the link instead of opening the fancyBox modal. Images within links are also not added to the fancyBox gallery for a post.
That said, if you have the flarum/bbcode
extension, you can use fancy
attribute of the URL
tag to show videos or iframes on the fancyBox modal. They will be added to the fancyBox gallery of the post.
-
Use
[URL fancy=iframe][/URL]
for iframes: -
Use
[URL fancy=video][/URL]
for videos (fancyBox supports YouTube, Vimeo & MP4):
You need to have the flarum/bbcode
extension in order to add captions. The title
attribute of the IMG
or the URL
tag will be automatically considered as a caption (the IMG
tag has the higher priority). Here are some possible usage examples:
[img title="Caption this."][/img]
[url title="Caption this." fancy]![](src)[/url]
[url title="Caption this." fancy=video][img][/img][/url]
[url fancy][img title="Caption this."][/img][/url]