Extension:Piwigo
Piwigo Release status: stable |
|
---|---|
Implementation | Parser function , Tag |
Description | An extension that shows photos from Piwigo |
Author(s) | Bertrand Gorge (BertrandGorgetalk) |
Latest version | 1.0 (25/08/2022) |
Compatibility policy | Master maintains backward compatibility. |
MediaWiki | |
License | MIT License |
Download | GitHub:
<translate> Note:</translate> https://github.com/neayi/mw-Piwigo/blob/main/README.md |
$wgPiwigoURL |
|
piwigo |
|
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
This extension displays a gallery of images extracted from a Piwigo setup.
The extension adds a <piwigo />
keyword and a {{#piwigo}}
parser function that show a gallery in a page. The keyword can contain the same kind of parameters as Piwigo's URL (category, tags, ...):
Installation
- <translate> Download and place the file(s) in a directory called <tvar name=name>
Piwigo
</tvar> in your <tvar name=ext>extensions/
</tvar> folder.</translate> - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
wfLoadExtension( 'Piwigo' );
- File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>
See also #CORS setting on the Piwigo server
Configuration parameters
You will need to add the following to your LocalSettings.php:
wfLoadExtension( 'Piwigo' ); $wgPiwigoURL = 'https://somegallery.piwigo.fr'; // $wgPiwigoGalleryLayout = 'fluid'; // one of the four: fluid (default), grid, thumbnails, clean
Usage
Tags parameter
You can select all photos for a given tag by using: {{#piwigo:tags=1-tagname}}
or <piwigo tags="1-tagname"/>
or <piwigo tags="1"/>
(only the tag id is relevant).
It is also possible to target more than one tag with the parser function: {{#piwigo: tags=3 | tags=4 | count=5 }}
(note that for that you'll need to use the parser function and not the keyword - ie. <piwigo tags=3 | tags=4 | count=5>
will only show images from tag 4)
If the tags parameter is set, the category is ignored.
Category parameter
The category parameter is used to select photos from an album. You cannot select both an album and a tag (both are mutually exclusive): {{#piwigo: category = 5}}
Count parameter
You can use the count parameter to limit the number of results: {{#piwigo: category = 5 | count = 10}}
or <piwigo tags="1" count = 4/>
Performance
The images are loaded in JS which means that the page is effectively cached as any wiki page, and checks for new images only at display time.
The images are shown using this JS gallery: https://tutorialzine.com/2017/02/freebie-4-bootstrap-galleries (the four layouts are available)
CORS setting on the Piwigo server
If MediaWiki and Piwigo are not hosted on the same domain, it will be necessary to setup CORS on Piwigo (so that Mediawiki's HTML can ping Piwigo's web services).
In order to do that, you might want to use the following Nginx config file (Piwigo's docker setup):
map $http_origin $allow_origin {
~^https?://(.*\.)?yourwikidomain.com(:\d+)?$ $http_origin;
~^https?://(.*\.)?localhost(:\d+)?$ $http_origin;
default "";
}
server {
listen 80 default_server;
listen 443 ssl;
root /config/www/gallery;
index index.html index.htm index.php;
server_name _;
ssl_certificate /config/keys/cert.crt;
ssl_certificate_key /config/keys/cert.key;
client_max_body_size 0;
# CORS
add_header 'Access-Control-Allow-Origin' $allow_origin;
add_header 'Access-Control-Allow-Methods' 'GET';
location / {
try_files $uri $uri/ /index.html /index.php?$args =404;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# With php5-cgi alone:
fastcgi_pass 127.0.0.1:9000;
# With php5-fpm:
#fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
- Pages with script errors
- Pages with broken file links
- Stable extensions
- Extensions without an image
- Parser function extensions
- Tag extensions
- Extensions with master compatibility policy
- Extensions without MediaWiki version
- MIT licensed extensions
- Extensions in GitHub version control
- ParserFirstCallInit extensions
- All extensions
- Extensions not in ExtensionJson