Skip to content

Commit

Permalink
提交一个svg bug修改
Browse files Browse the repository at this point in the history
  • Loading branch information
bugluo authored and bugluo committed Sep 28, 2016
1 parent 08124df commit 706a843
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/fastimagesize.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,15 @@ module.exports = exports = function (file_path, callback) {

function getSVGImageSize(data) {
var retInfo = {};

retInfo.width = 0;
retInfo.height = 0;
retInfo.type = 'svg';
retInfo.width = data.match(/<svg(.*?)width="(.*?)px/)[2];
retInfo.height = data.match(/<svg(.*?)height="(.*?)px/)[2];
try{
retInfo.width = data.match(/<svg(.*?)width=["|'](.*?)(px)?["|']/)[2];
retInfo.height = data.match(/<svg(.*?)height=["|'](.*?)(px)?["|']/)[2];
}catch(e){

}
return retInfo;
}

Expand Down

0 comments on commit 706a843

Please sign in to comment.