26 $this->repoGroup = $repoGroup;
27 $this->hookRunner =
new HookRunner( $hookContainer );
37 private function getFileNamesByPageId( array $identitiesByPageId ): array {
38 $fileIdentitiesByPageId = array_filter(
41 return $pageIdentity->getNamespace() ===
NS_FILE;
46 static function ( PageIdentity $pageIdentity ) {
47 return $pageIdentity->getDBkey();
49 $fileIdentitiesByPageId
61 $size ??= self::THUMBNAIL_SIZE;
63 $thumb = $file->
transform( [
'width' => $size ] );
64 if ( !$thumb || $thumb->isError() ) {
70 $thumb->getFile()->getMimeType(),
85 public function getThumbnails( array $pageIdentities, ?
int $size = 60 ): array {
87 $fileNamesByPageId = $this->getFileNamesByPageId( $pageIdentities );
89 foreach ( $fileNamesByPageId as $pageId => $fileName ) {
90 $file = $this->repoGroup->findFile( $fileName );
94 $thumbnail = $this->buildSearchResultThumbnailFromFile( $file, $size );
96 $results[$pageId] = $thumbnail;
101 $this->hookRunner->onSearchResultProvideThumbnail( $pageIdentities, $results, $size );
Implements some public methods and some protected utility functions which are required by multiple ch...
getName()
Return the name of this file.
transform( $params, $flags=0)
Transform a media file.
Prioritized list of file repositories.
Interface for objects (potentially) representing an editable wiki page.