}
} elseif ( $this->repo && $thumb->hasFile() && !$thumb->fileIsSource() ) {
// Copy the thumbnail from the file system into storage...
- $disposition = FileBackend::makeContentDisposition( 'inline', $this->name );
+ $disposition = $this->getThumbDisposition( $thumbName );
$status = $this->repo->quickImport( $tmpThumbPath, $thumbPath, $disposition );
if ( $status->isOK() ) {
$thumb->setStoragePath( $thumbPath );
return is_object( $thumb ) ? $thumb : false;
}
+ /**
+ * @param $thumbName string Thumbnail name
+ * @return string Content-Disposition header value
+ */
+ function getThumbDisposition( $thumbName ) {
+ $fileName = $this->name; // file name to suggest
+ $thumbExt = FileBackend::extensionFromPath( $thumbName );
+ if ( $thumbExt != '' && $thumbExt !== $this->getExtension() ) {
+ $fileName .= ".$thumbExt";
+ }
+ return FileBackend::makeContentDisposition( 'inline', $fileName );
+ }
+
/**
* Hook into transform() to allow migration of thumbnail files
* STUB
$path = '/common/images/icons/' . $icon;
$filepath = $wgStyleDirectory . $path;
if ( file_exists( $filepath ) ) { // always FS
- return new ThumbnailImage( $this, $wgStylePath . $path, 120, 120 );
+ $params = array( 'width' => 120, 'height' => 120 );
+ return new ThumbnailImage( $this, $wgStylePath . $path, false, $params );
}
}
return null;