/** * ------------------------------------------------------------------------ * resizeImage Plugin * ------------------------------------------------------------------------ * Copyright (C) 2012-2013 SUNLAND Co., JSC. All Rights Reserved. * license - GNU/GPL, http://www.gnu.org/licenses/gpl.html * Author: Sonle * Email: sonlv@templaza.com * Websites: http://www.templaza.com * ------------------------------------------------------------------------ */ var resizeImage = function (widthImage, heightImage, widthStage, heightStage) { var escImageX = widthStage / widthImage; var escImageY = heightStage / heightImage; var escalaImage = (escImageX > escImageY) ? escImageX : escImageY; var widthV = widthImage * escalaImage; var heightV = heightImage * escalaImage; var posImageY = 0; var posImageX = 0; if (heightV > heightStage) { posImageY = (heightStage - heightV) / 2; }; if (widthV > widthStage) { posImageX = (widthStage - widthV) / 2; }; return { top: posImageY, left: posImageX, width: widthV, height: heightV }; }; /* FILE ARCHIVED ON 11:16:15 Mar 12, 2020 AND RETRIEVED FROM THE INTERNET ARCHIVE ON 11:16:45 Mar 12, 2020. JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)). */ /* playback timings (ms): exclusion.robots: 0.148 load_resource: 269.987 RedisCDXSource: 72.146 exclusion.robots.policy: 0.14 esindex: 0.009 LoadShardBlock: 112.364 (3) captures_list: 199.936 PetaboxLoader3.datanode: 111.516 (3) CDXLines.iter: 12.807 (3) */