* @param $html String: Additional HTML text to be shown. The name and size of the image are always shown.
* @param $alt String: Alt text for the image
* @param $link String: Override image link (optional)
+ * @param $handlerOpts Array: Array of options for image handler (aka page number)
*/
- function add( $title, $html = '', $alt = '', $link = '' ) {
+ function add( $title, $html = '', $alt = '', $link = '', $handlerOpts = array() ) {
if ( $title instanceof File ) {
// Old calling convention
$title = $title->getTitle();
}
- $this->mImages[] = array( $title, $html, $alt, $link );
+ $this->mImages[] = array( $title, $html, $alt, $link, $handlerOpts );
wfDebug( 'ImageGallery::add ' . $title->getText() . "\n" );
}
* @param $title Title object of the image that is added to the gallery
* @param $html String: Additional HTML text to be shown. The name and size of the image are always shown.
* @param $alt String: Alt text for the image
+ * @param $link String: Override image link (optional)
+ * @param $handlerOpts Array: Array of options for image handler (aka page number)
*/
- function insert( $title, $html = '', $alt = '' ) {
+ function insert( $title, $html = '', $alt = '', $link = '', $handlerOpts = array() ) {
if ( $title instanceof File ) {
// Old calling convention
$title = $title->getTitle();
}
- array_unshift( $this->mImages, array( &$title, $html, $alt ) );
+ array_unshift( $this->mImages, array( &$title, $html, $alt, $link, $handlerOpts ) );
}
/**
$text = $pair[1]; # "text" means "caption" here
$alt = $pair[2];
$link = $pair[3];
+ // $pair[4] is per image handler options
+ $transformOptions = $params + $pair[4];
$descQuery = false;
if ( $nt->getNamespace() == NS_FILE ) {
# We're dealing with a non-image, spit out the name and be done with it.
$thumbhtml = "\n\t\t\t" . '<div style="height: ' . ( self::THUMB_PADDING + $this->mHeights ) . 'px;">'
. htmlspecialchars( $nt->getText() ) . '</div>';
+
+ if ( $this->mParser instanceof Parser ) {
+ $this->mParser->addTrackingCategory( 'broken-file-category' );
+ }
} elseif ( $this->mHideBadImages && wfIsBadImage( $nt->getDBkey(), $this->getContextTitle() ) ) {
# The image is blacklisted, just show it as a text link.
$thumbhtml = "\n\t\t\t" . '<div style="height: ' . ( self::THUMB_PADDING + $this->mHeights ) . 'px;">' .
array( 'known', 'noclasses' )
) .
'</div>';
- } elseif ( !( $thumb = $img->transform( $params ) ) ) {
+ } elseif ( !( $thumb = $img->transform( $transformOptions ) ) ) {
# Error generating thumbnail.
$thumbhtml = "\n\t\t\t" . '<div style="height: ' . ( self::THUMB_PADDING + $this->mHeights ) . 'px;">'
. htmlspecialchars( $img->getLastError() ) . '</div>';