Skip to content

Commit

Permalink
Merge pull request #1 from MarkVaughn/patch-1
Browse files Browse the repository at this point in the history
for matching example.png.JPG as jpeg
  • Loading branch information
doomhz committed Oct 26, 2011
2 parents d80c4e5 + 1f38b62 commit dd3142a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions assets/jquery.imageCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
var ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0);

var imgType = img.src.match(/(jpg|jpeg|png)/);
var imgType = img.src.match(/\.(jpg|jpeg|png)$/i);
if (imgType && imgType.length) {
imgType = imgType[0] == 'jpg' ? 'jpeg' : imgType[0];
imgType = imgType[1].toLowerCase() == 'jpg' ? 'jpeg' : imgType[1].toLowerCase();
} else {
throw 'Invalid image type for canvas encoder: ' + img.src;
}
Expand Down

0 comments on commit dd3142a

Please sign in to comment.