From 52663bc34ae818de545e37d1fb665669b27c34d1 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 31 Mar 2021 17:43:50 +0800 Subject: [PATCH] Roo/bootstrap/Card.js --- Roo/bootstrap/Card.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Roo/bootstrap/Card.js b/Roo/bootstrap/Card.js index 2bbe1dafb6..98d2bed26e 100644 --- a/Roo/bootstrap/Card.js +++ b/Roo/bootstrap/Card.js @@ -751,6 +751,23 @@ Roo.extend(Roo.bootstrap.Card, Roo.bootstrap.Component, { if (this.headerContainerEl) { this.headerContainerEl.dom.innerHTML = html; } + }, + onHeaderImageLoad : function(he) + { + if (!this.header_image_fit_square) { + return; + } + + var hw = he.dom.naturalHeight / he.dom.naturalWidth; + // wide image = < 0 + // tall image = > 1 + //var w = he.dom.naturalWidth; + var ww = he.dom.width; + if (hw > 1) { + he.dom.width = ww * (1/hw); + he.dom.height = ww; + } + } -- 2.39.2