/** * Get thumbs of recently uploaded files */ public static function getRecentlyUploadedThumbs($limit = 50) { wfProfileIn(__METHOD__); $ret = array(); // get list of recently uploaded images $uploadedImages = MediaQueryService::getRecentlyUploaded($limit); if (is_array($uploadedImages)) { foreach ($uploadedImages as $image) { $thumb = self::getResultsThumbnailUrl($image); if ($thumb) { // use keys to remove duplicates $ret[] = array('name' => $image->getText(), 'thumb' => $thumb); } } } wfProfileOut(__METHOD__); return $ret; }
/** * Add given number of recently uploaded images to slideshow */ private function addRecentlyUploaded($limit) { wfProfileIn(__METHOD__); $uploadedImages = MediaQueryService::getRecentlyUploaded($limit); // remove images already added to slideshow $this->mFiles = array(); $this->mData['imagesShown'] = array(); // add recently uploaded images to slideshow if (!empty($uploadedImages)) { /** @var Title $image */ foreach ($uploadedImages as $image) { $this->add($image); // store list of images (to be used by front-end) $this->mData['imagesShown'][] = array('name' => $image->getText(), 'caption' => '', 'link' => '', 'linktext' => '', 'recentlyUploaded' => true, 'shorttext' => ''); // Only add real images (bug #5586) if ($image->getNamespace() == NS_FILE) { $this->mParser->mOutput->addImage($image->getDBkey()); } } } wfProfileOut(__METHOD__); }