Dbrant has uploaded a new change for review.

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

Change subject: Don't show lead image if it's a .GIF
......................................................................

Don't show lead image if it's a .GIF

If the API returns a GIF image as the lead image for an article, then
simply don't show it.  GIF images are usually used for mathematical or
engineering diagrams, and don't look good as "lead" images. Moreover, GIFs
are very likely to be animated, which also isn't good (and doesn't work)
for a lead image.

Change-Id: Ie91c59403d9747dcb85e7d8b4fba1ff3973dc6ef
---
M wikipedia/src/main/java/org/wikipedia/page/leadimages/LeadImagesHandler.java
1 file changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/77/182877/1

diff --git 
a/wikipedia/src/main/java/org/wikipedia/page/leadimages/LeadImagesHandler.java 
b/wikipedia/src/main/java/org/wikipedia/page/leadimages/LeadImagesHandler.java
index cf9463c..8226948 100644
--- 
a/wikipedia/src/main/java/org/wikipedia/page/leadimages/LeadImagesHandler.java
+++ 
b/wikipedia/src/main/java/org/wikipedia/page/leadimages/LeadImagesHandler.java
@@ -283,7 +283,14 @@
             leadImagesEnabled = false;
         } else {
             // enable the lead image, only if we actually have a url for it
-            leadImagesEnabled = thumbUrl != null;
+            if (thumbUrl == null) {
+                leadImagesEnabled = false;
+            } else {
+                // ...and only if the image is not a GIF, since GIF images are 
usually
+                // mathematical diagrams or animations that won't look good as 
a lead image.
+                // TODO: retrieve the MIME type of the lead image, instead of 
relying on file name.
+                leadImagesEnabled = !thumbUrl.endsWith(".gif");
+            }
         }
 
         // set the page title text, and honor any HTML formatting in the title

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie91c59403d9747dcb85e7d8b4fba1ff3973dc6ef
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <dbr...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to