Permalink
Browse files

Merge pull request #1 from MarkVaughn/patch-1

for matching example.png.JPG as jpeg
  • Loading branch information...
2 parents d80c4e5 + 1f38b62 commit dd3142a7a4abf51d731c9c62a2261970fc7fa4eb @doomhz committed Oct 26, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 assets/jquery.imageCache.js
View
4 assets/jquery.imageCache.js
@@ -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;
}

0 comments on commit dd3142a

Please sign in to comment.