mobile.mi.com - see bug description
URL: http://mobile.mi.com/in/mipad/ Browser / Version: Firefox Mobile 46.0 Operating System: Android 5.0.2 Problem type: Something else - I'll add details below
Steps to Reproduce
- Navigate to: http://mobile.mi.com/in/mipad/
- Image resolution is extremely bad Almost pixelized.
Expected Behavior: High res images
Actual Behavior: Bad quality of images
Surprisingly it's only certain images that are like this. Some others are rendered perfect. But chrome on android does a clean job with all of them.

i can replicate this
Ah this seems related to the same thing I just look at #2374
Switching to needsdiagnosis. I started investigating in #2374 I see where in the JS the size of images are set, but I haven't found why we are not getting the same treatment.
This site is using Zepto too. I know we had issues in the past with this library.
Just to double check, we're getting the same markup sent:
miket at omg-3 in ~
🐓 http GET http://mobile.mi.com/in/mipad/ User-Agent:"$CHRM" | grep jpg
<img alt="Mi Pad" data-original="http://i01.appmifile.com/v1/MI_18455B3E4DA706226CF7535A58E875F0267/T1zsVgBvLv1RXrhCrK.jpg">
miket at omg-3 in ~
🐓 http GET http://mobile.mi.com/in/mipad/ User-Agent:"$FFA" | grep jpg
<img alt="Mi Pad" data-original="http://i01.appmifile.com/v1/MI_18455B3E4DA706226CF7535A58E875F0267/T1zsVgBvLv1RXrhCrK.jpg">
Chrome gets src set to //i01.appmifile.com/v1/MI_25943454643F6/T1akEjBbWT1RXrhCrK!268x268!70.jpg, while Fennec gets //i01.appmifile.com/v1/MI_25943454643F6/T1akEjBbWT1RXrhCrK!246x40!70.jpg (note 268 vs 40)
Too sleepy right now to find the bug in XIAOMI.app.lazyLoad, in http://s03.appmifile.com/js/in/xm.base.js?C73d34ead5f76753a093614fb5826b71b (if someone wants to beat me to it).
I have encountered the same type of issue at http://mobile.mi.com/in/mipad/#specs on a mobile device running Operating System: Android 5.0.1. Please find details below:
URL: http:http://mobile.mi.com/in/mipad/#specs Browser / Version: Firefox Mobile 46.0 Operating System: Android 5.0.1
Steps to Reproduce: Navigate to: http://mobile.mi.com/in/mipad/#specs Image resolution is extremely pixelized.
Expected Behavior: A High resolution images should be displayed
Actual Behavior: Image is of bad quality
Checking the request URL for the image I guess should help, it is a parametrized URI
GET /v1/MI_18455B3E4DA706226CF7535A58E875F0267/T1zsVgBvLv1RXrhCrK!51x16!70.jpg HTTP/1.1
Host: i01.appmifile.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:48.0) Gecko/20100101 Firefox/48.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://mobile.mi.com/in/mipad/
Connection: keep-alive
If-Modified-Since: Tue, 01 Mar 2016 03:27:56 GMT
Cache-Control: max-age=0
I'm getting: !51x16!70.jpg for the parameters.
I see also http://m.buy.mi.com/in/misc/getgoodsinformation/?tag=mipad&jsonpcallback=jsonp1 returns a weird file with probably the wrong HTTP content-type text/html. This is happening just before the HTTP request to the image.
HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Content-Encoding: gzip
Content-Type: text/html; charset=utf-8
Custom-Status: 0
Date: Thu, 24 Mar 2016 01:52:34 GMT
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Server: Tengine
Vary: Accept-Encoding
Content-Length: 791
Connection: keep-alive
The text/html response is:
if (window.jsonp1) jsonp1({
"errno": 0,
"errmsg": "Success",
"data": {
"goodsinformation": {
"4151000005": {
"image": "http:\/\/i01.appmifile.com\/v1\/MI_18455B3E4DA706226CF7535A58E875F0267\/T1zsVgBvLv1RXrhCrK.jpg",
"is_cos": false,
"is_bigtap": false,
"is_damiao": false,
"name": "Mi Pad 16G White",
"id": "4151000005",
"sku": "9914",
"is_sale": true,
"price": "10999",
"style_name": "16G",
"commodity_id": "3151000006",
"product_name": "Mi Pad",
"currency": "Rs.",
"is_presale": false,
"presale_cos": true,
"has_packet": false,
"has_recommend": false,
"tag": "mipad",
"needSubscribe": false,
"status": 0,
"diff": 0,
"pb_start": 0
}
},
"packset": [],
"lowestprice": "10999",
"highestprice": "10999",
"equalprice": true,
"insurances": {
"4151000005": {
"name": "Mi Protect",
"short_name": "Mi Protect",
"price": "375",
"market_price": "375",
"sku": "12084",
"goods_id": "4154700013",
"image_url": "http:\/\/i01.appmifile.com\/v1\/MI_18455B3E4DA706226CF7535A58E875F0267\/T1DdYvBTxv1R4cSCrK.png",
"type": "mi4i"
}
},
"zipcode": [],
"choice_data": {
"title": "Mi Pad",
"tag": "mipad",
"category": "",
"image": "http:\/\/i01.appmifile.com\/v1\/MI_18455B3E4DA706226CF7535A58E875F0267\/T1zsVgBvLv1RXrhCrK.jpg",
"album": ["http:\/\/i01.appmifile.com\/v1\/MI_18455B3E4DA706226CF7535A58E875F0267\/T1zsVgBvLv1RXrhCrK.jpg"],
"describe": null,
"support": [{
"name": "FREE Delivery",
"link": "",
"note": ""
}, {
"name": "Cash on Delivery",
"link": "",
"note": "Cash on Delivery (COD) payment mode is available only in select areas. Please enter your pin-code below to check if your address is eligible for COD."
}],
"rank": {
"color": {
"name": "Select a Color",
"show_price": "",
"all": {
"White": {
"name": "White",
"zh": "\u767d\u8272",
"rgb": "#FFFFFF",
"img": ""
}
}
}
},
"tree": {
"White": {
"goods_ids": ["4151000005"],
"ids": ["4151000005"],
"attr": {
"name": "White",
"zh": "\u767d\u8272",
"rgb": "#FFFFFF",
"img": "",
"image": "http:\/\/i01.appmifile.com\/v1\/MI_18455B3E4DA706226CF7535A58E875F0267\/T1zsVgBvLv1RXrhCrK.jpg"
}
}
}
}
}
});
Putting a breaking point on XIAOMI.app.lazyLoad = function (t) { doesn't stop anything in firefox devtools, but it works if you put it on
XIAOMI.namespace('app.cookie', 'app.lazyLoad', 'app.tabMenu', 'app.winTips', 'app.getAjax', 'app.cartNum', 'app.addCart', 'app.headerMenu', 'app.formatNum', 'app.formatToNum', 'app.slide'),
which is a bit meh but we can survive. :)
Ah the call to the strange json is done in http://s03.appmifile.com/js/in/products/p.mipad.js?C5c6097811855c62286d644d74c44226f
e.ajax({
type: 'get',
url: XIAOMI.GLOBAL_CONFIG.orderSite + '/misc/getgoodsinformation/',
dataType: 'jsonp',
jsonp: 'jsonpcallback',
data: p,
cache: !0,
success: function (i) {
a = i.data,
h(a);
//… etc
Parameters for the images are set in the lazyload function.
var a = this,
i = (e.defHeight, 'object' == typeof e.defObj ? e.defObj.find('img[data-original], .xm-lazy') : $(e.defObj).find('img[data-original], .xm-lazy')),
o = [
],
s = parseFloat($(window.document.documentElement).css('font-size')),
r = window.devicePixelRatio,
l = 1999,
c = window.location.href.toLowerCase(),
d = /(_network_type=)\w*/.exec(c),
p = /(_img_quality=)\w*/.exec(c),
u = d ? d[0].replace(/_network_type=/, '') : 'empty',
u = u ? u : 'empty',
f = p ? p[0].replace(/_img_quality=/, '') : '',
h = {
_default: '!40',
'default': '!60',
wifi: '!70',
empty: '!70'
},
u = h[u] ? u : r >= 2 ? '_default' : 'default',
f = e.hasquality ? f ? '!' + f : h[u] : '',
m = function () {
var t = document,
n = window.pageYOffset ? window.pageYOffset : Math.max(t.documentElement.scrollTop, t.body.scrollTop);
return n + e.defHeight
},
g = function (t) {
var n = t.data('original'),
e = Math.ceil(parseFloat(t.width()) * r),
a = Math.ceil(parseFloat(t.height()) * r || l);
if (e && a) {
var i = '!' + e + 'x' + a;
n = n.replace(/(\.jpg|\.png)/, i + f + '$1')
}
t.attr('src', n)
};
The markup sent by the server is
<div class="xm-slide">
<div class="xm-slide-scroll J_lazyLoadBox">
<figure>
<img alt="Mi Pad" data-original="http://i01.appmifile.com/v1/MI_18455B3E4DA706226CF7535A58E875F0267/T1zsVgBvLv1RXrhCrK.jpg">
</figure>
</div>
</div>
to compare to
<div class="xm-slide">
<div class="xm-slide-scroll J_lazyLoadBox">
<figure style="width: 100%;">
<img class="xm-gradualimg" src="http://i01.appmifile.com/v1/MI_18455B3E4DA706226CF7535A58E875F0267/T1zsVgBvLv1RXrhCrK!102x31!70.jpg" alt="Mi Pad">
</figure>
</div>
</div>
When reaching finally the img stuff.
g = function (t) {
var n = t.data('original'),
e = Math.ceil(parseFloat(t.width()) * r),
a = Math.ceil(parseFloat(t.height()) * r || l);
if (e && a) {
var i = '!' + e + 'x' + a;
n = n.replace(/(\.jpg|\.png)/, i + f + '$1')
}
t.attr('src', n)
};
e and a are multiplied by r which is r = window.devicePixelRatio.
so when t.attr('src', n) kicks in it is set. Currently for me in my
"http://i01.appmifile.com/v1/MI_18455B3E4DA706226CF7535A58E875F0267/T1zsVgBvLv1RXrhCrK!91x28!70.jpg"
all of this was triggered by
this.imgLoad = function () {
var t = !1,
n = m();
i.each(function (a) {
var s = $(this);
o[a] <= n && (t = !0, i = i.not(s), o.splice(a, 1, 0), 'img' === s[0].tagName.toLowerCase() ? (g(s), s.on('load', function () {
e.graduallyShow ? s.removeAttr('data-original').addClass('xm-gradualimg') : s.removeAttr('data-original'),
s.next('.J_imgPlaceholder').remove()
})) : s.removeClass('xm-lazy'))
}),
t === !0 && (o = $.grep(o, function (t) {
return t > 0
}))
},
this.imgLoad(),
The event propagation seems to stop sometimes. Not sure why.
It seems it has been fixed.
Closing as worksforme. As we didn't make an attempt at contacting them.
@karlcow it still happens here and other subtopics of the MI pad page as well
http://mobile.mi.com/in/mipad/#design