MaxSem has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/93801


Change subject: [Card 1366] Add page image to last edited information
......................................................................

[Card 1366] Add page image to last edited information

Change-Id: Ia13b3eab2e6ed04c4cd5355aec50248715418e75
Dependency: I3e891ee65476eb72b5ffd65d9af3ac1f080d849e
---
M includes/specials/SpecialUserProfile.php
1 file changed, 16 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/01/93801/1

diff --git a/includes/specials/SpecialUserProfile.php 
b/includes/specials/SpecialUserProfile.php
index 19fae46..8e2987a 100644
--- a/includes/specials/SpecialUserProfile.php
+++ b/includes/specials/SpecialUserProfile.php
@@ -1,6 +1,8 @@
 <?php
 
 class SpecialUserProfile extends MobileSpecialPage {
+       const IMAGE_SIZE = 50;
+
        protected $mode = 'beta';
 
        /**
@@ -89,8 +91,22 @@
                $rev = $this->userInfo->getLastEdit();
                if ( $rev ) {
                        $daysAgo = $this->getDaysAgo( new MWTimestamp( 
wfTimestamp( TS_UNIX, $rev->getTimestamp() ) ) );
+                       $imageHtml = '';
+                       if ( defined( 'PAGE_IMAGES_INSTALLED' ) ) {
+                               $title = $rev->getTitle();
+                               $file = PageImages::getPageImage( $title );
+                               if ( $file ) {
+                                       $thumb = $file->transform( array( 
'width' => self::IMAGE_SIZE, 'height' => self::IMAGE_SIZE ) );
+                                       if ( $thumb && $thumb->getUrl() ) {
+                                               $imageHtml = Html::element( 
'img',
+                                                       array( 'src' => 
wfExpandUrl( $thumb->getUrl(), PROTO_CURRENT ) )
+                                               );
+                                       }
+                               }
+                       }
                        $html = Html::openElement( 'div', array( 'class' => 
'card' ) )
                                . Html::openElement( 'div', array( 'class' => 
'caption' ) )
+                               . $imageHtml
                                . $this->msg( 
'mobile-frontend-profile-last-edit',
                                        $rev->getTitle(),
                                        $daysAgo

-- 
To view, visit https://gerrit.wikimedia.org/r/93801
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia13b3eab2e6ed04c4cd5355aec50248715418e75
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to