Extension:PicLens

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png
PicLens

Release status: stable

PicLensExtension.png
Implementation Special page, Tag, MyWiki
Description Media RSS support for gallery tag, and PicLens integration
Author(s) (Cchanteptalk)
Latest version 1.0-SNAPSHOT
MediaWiki 1.11.x-1.16.0
License No license specified
Download here
Example exemple 1
Parameters

$wgMediaRssLogo

Hooks used
BeforePageDisplay

ParserAfterStrip

Translate the PicLens extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

This extension adds support to Mediawiki's standard <gallery /> tag. This allows it to generate Media RSS content from any article that contains such tags. It allows you to add a RSS Media link to any article that does not have gallery with a special comment. It also allows the PicLens plugin to be used with such RSS with another particular tag.

Usage[edit | edit source]

Download instructions[edit | edit source]

You can download extension from there.

Installation[edit | edit source]

  1. Extract extension
  2. Move PicLens to your extensions directory
  3. Copy LocalSettings.part content into your LocalSettings.php :
/* If you want custom MediaRSS logo, displayed in PicLens topbar
global $wgMediaRssLogo;
$wgMediaRssLogo = "{$wgScriptPath}/logo_height26px.png";
*/
require_once( "$IP/extensions/PicLens/PicLens.setup.php" );

Configuration parameters[edit | edit source]

  • $wgMediaRssLogo specify an image file that can be used as Media RSS icon. This is displayed in PicLens topbar.

Synopsis[edit | edit source]

Article with gallery tag[edit | edit source]

From article you add some gallery, you can launch PicLens plugin with button added in your browser personnal bar.

You can also add a JavaScript link in your article with a tag provided by this extension :

<picLensLauncher>My launch text</picLensLauncher>

… which will display such HTML content :

<a href="#" onclick="javascript:PicLensLite.start();" class="picLensLauncher" title="PicLensLite">My launch text</a>

JavaScript object PicLensLite is maid available by an head script also automatically provided by this extension.

With generated html attribute class="picLensLauncher" you can customize this link with some CSS selector.

Other article[edit | edit source]

If you can to add a Media RSS to an article that does not use any gallery, you can do it with the special comment <!-- PicLensRSS: url -->.

You just have to replace url by an absolute (<!-- PicLensRSS: http://www.mysite.com/photo.rss -->) or by another wiki article that contains <gallery /> tag(s) (<!-- PicLensRSS: OtherArticleWithGallery -->).

Patches[edit | edit source]

The default code will not include gallery images without a description in the generated RSS feed used to display the images. To do so, change the following code in PicLens.body.php:

        foreach ($parts as $p) {
          $pos = strpos($p, '|');
#change starts here
          # If it doesn't have a description, use the image title
          if ($pos === false)
          {
            $it = $p;
            $descr = substr($p, strpos($p, ':')+1);
          }
          else
          {
            $it = trim( substr($p, 0, $pos) );
            $descr = trim( substr($p, $pos+1) );
          }
#change ends here
          $title = Title::newFromText($it);
          $img = wfFindFile( $title, false );