* @param $thumbUrl string Thumbnail URL
* @param $params Array
* @param $flags integer
+ * @param $status Status Optional status object to use for errors
* @return MediaTransformOutput
*/
- protected function transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags ) {
+ protected function transformErrorOutput(
+ $thumbPath, $thumbUrl, $params, $flags, Status $status = null
+ ) {
global $wgIgnoreImageErrors;
if ( $wgIgnoreImageErrors && !( $flags & self::RENDER_NOW ) ) {
return $this->handler->getTransform( $this, $thumbPath, $thumbUrl, $params );
} else {
+ $badStatus = Status::newFatal( 'thumbnail-dest-create' );
+ if ( $status ) { // additional, more detailed errors
+ $badStatus->merge( $status );
+ }
+ $err = array();
+ foreach ( $badStatus->getErrorsArray() as $item ) {
+ $err[] = wfMsg( $item[0], array_slice( $item, 1 ) );
+ }
return new MediaTransformError( 'thumbnail_error',
- $params['width'], 0, wfMsg( 'thumbnail-dest-create' ) );
+ $params['width'], 0, implode( "\n", $err ) ); // MTO does "\n" => "<br/>"
}
}
if ( $status->isOK() ) {
$thumb->setStoragePath( $thumbPath );
} else {
- $thumb = $this->transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags );
+ $thumb = $this->transformErrorOutput(
+ $thumbPath, $thumbUrl, $params, $flags, $status );
}
}