Authored by 黄涛

Merge branch 'hotfix/imageslim' into 'gray'

imageslim



See merge request !105
... ... @@ -89,7 +89,7 @@
<ul class="package-goods clearfix">
{{#each goods_list}}
<li class="left">
<img class="lazy package-goods-img" data-original="{{image goods_images 68 90}}">
<img class="lazy package-goods-img" data-original="{{image2 goods_images w=68 h=90}}">
{{#isEqual goods_type 'gift'}}
<span>赠品</span>
{{/isEqual}}
... ... @@ -124,7 +124,7 @@
<td{{#if @first}} class="border-top"{{/if}}></td>
<td class="border-top aline-left">
<a class="image" href="{{linkToGoods}}">
<img src="{{image goods_images 64 85}}" class="thumb">
<img src="{{image2 goods_images w=64 h=85}}" class="thumb">
<p class="name">
{{#isEqual goods_type 'gift'}}
<span>赠品</span>
... ...
... ... @@ -4,7 +4,7 @@
{{# imgBrand}}
<li class="img-item">
<a href="{{url}}" target= "_blank" title="{{title}}">
<img data-original="{{image src 378 175}}" src="{{image2 src w=378 h=175}}" alt="{{alt}}">
<img data-original="{{image2 src w=378 h=175}}" src="{{image2 src w=378 h=175}}" alt="{{alt}}">
</a>
</li>
{{/ imgBrand}}
... ...
... ... @@ -62,7 +62,7 @@
{{#each trendList}}
<li>
<a href="{{href}}">
<img src="{{image src 264 173}}" />
<img src="{{image2 src w=264 h=173}}" />
<div class="main-title">{{mainTitle}}</div>
<div class="sub-title">{{Subtitle}}</div>
</a>
... ...
{{# mainBanner}}
<div class="main-banner slide-container"{{#unless list}} style="background:url({{image src 1920 450}}) no-repeat top center;"{{/unless}}>
<div class="main-banner slide-container"{{#unless list}} style="background:url({{image2 src w=1920 h=450}}) no-repeat top center;"{{/unless}}>
{{#if list}}
<div class="slide-wrapper">
<ul>
{{# list}}
<li class="banner-img" style="background: {{bgColor}} url({{image src 1920 450}}) no-repeat top center;">
<li class="banner-img" style="background: {{bgColor}} url({{image2 src w=1920 h=450}}) no-repeat top center;">
{{#if url}}
<a href="{{url}}" target= "_blank"></a>
{{/if}}
... ...
{{# banner}}
<div class="brand-banner" style="background:{{bgColor}}{{#if bgImg}} url({{image bgImg 1920 45}}){{/if}}">
<div class="brand-banner" style="background:{{bgColor}}{{#if bgImg}} url({{image2 bgImg w=1920 h=45}}){{/if}}">
<div class="center-content clearfix">
<a class="pull-left" href="{{homeUrl}}">
<img src="{{logo}}">
... ...
... ... @@ -5,7 +5,7 @@
<div class="color-row">
{{#each colors}}
<div class="dt {{#if active}} active current-color{{/if}} {{#if disable}} disabled{{/if}}"
data-pic="{{image pic 100 134}}"
data-pic="{{image2 pic w=100 h=134}}"
data-pid="{{pid}}"
{{!--data-target="{{proId}}-color-{{@index}}"
data-title="{{this.color}}" --}}
... ... @@ -40,9 +40,9 @@
{{# colors}}
<div class="bigImg {{#unless active}} hide{{/unless}}">
{{#if pic}}
<img src="{{image pic 100 134}}" />
<img src="{{image2 pic w=100 h=134}}" />
{{else}}
<img src="{{image ../defaultImg 100 134}}" />
<img src="{{image2 ../defaultImg w=100 h=134}}" />
{{/if}}
</div>
{{/ colors}}
... ...
... ... @@ -14,7 +14,7 @@
<div class="good-info" data-skn="{{skn}}" data-id="{{id}}" data-index="{{@index}}">
<div class="good-detail-img">
<a class="good-thumb" href="{{url}}" target="_blank">
<img class="lazy" src="{{image src 100 135}}" style="display: block;">
<img class="lazy" src="{{image2 src w=100 h=135}}" style="display: block;">
</a>
</div>
<div class="good-detail-text stu-good-detail ">
... ...
... ... @@ -3,8 +3,10 @@
var cdnDomains = require('../../../../config/dns-prefetch');
function cdnReplace(cdn, imgUrl) {
var key;
if (cdn === 'qcloud') {
for (var key in cdnDomains) {
for (key in cdnDomains) {
if (imgUrl.indexOf(key) >= 0) {
imgUrl = imgUrl.replace(key, cdnDomains[key]);
}
... ... @@ -15,12 +17,13 @@ function cdnReplace(cdn, imgUrl) {
module.exports = function(imageUrl, opts) {
var cdn = window.cdn;
var params, urls, query, uri;
if (imageUrl) {
var params = opts.hash;
var urls = imageUrl.split('?');
var query = urls[1] || '';
var uri = urls[0];
params = opts.hash;
urls = imageUrl.split('?');
query = urls[1] || '';
uri = urls[0];
if (uri.indexOf('http:') === 0) {
uri = uri.replace('http:', '');
... ... @@ -29,7 +32,8 @@ module.exports = function(imageUrl, opts) {
uri = cdnReplace(cdn, uri);
if (query) {
query = query.replace(/{width}/g, params.w).replace(/{height}/g, params.h).replace(/{mode}/g, (params.mode || 2));
query = query.replace(/{width}/g, params.w).replace(/{height}/g,
params.h).replace(/{mode}/g, (params.mode || 2));
if (query.indexOf('imageView2') === 0) {
if (params.q && query.indexOf('/q/') > 0) {
... ... @@ -57,7 +61,7 @@ module.exports = function(imageUrl, opts) {
} else {
query = 'imageView2/2/interlace/1/q/' + (params.q || 75);
}
return uri + '?' + query;
return uri + '?' + query + '&imageslim';
} else {
return imageUrl;
}
... ...
'use strict';
const url = require('url');
// const url = require('url');
const _ = require('lodash');
const config = require('../config/common');
const assetUrl = config.assetUrl;
// const config = require('../config/common');
// const assetUrl = config.assetUrl;
let cdnDomains = require('../config/dns-prefetch');
... ... @@ -35,7 +37,8 @@ module.exports = {
uri = cdnReplace(cdn, uri);
if (query) {
query = query.replace(/{width}/g, params.w).replace(/{height}/g, params.h).replace(/{mode}/g, (params.mode || 2));
query = query.replace(/{width}/g, params.w).replace(/{height}/g, params.h).
replace(/{mode}/g, (params.mode || 2));
if (query.indexOf('imageView2') === 0) {
if (params.q && query.indexOf('/q/') > 0) {
... ... @@ -63,7 +66,7 @@ module.exports = {
} else {
query = 'imageView2/2/interlace/1/q/' + (params.q || 75);
}
return uri + '?' + query;
return uri + '?' + query + '&imageslim';
} else {
return '';
}
... ...