Permalink
Browse files

for matching .png.JPG as jpeg

  • Loading branch information...
MarkVaughn committed Oct 26, 2011
1 parent d80c4e5 commit b636282a84585025a0ee5edee8949a371a7b8140
Showing with 2 additions and 2 deletions.
  1. +2 −2 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[0].toLowerCase() == 'jpg' ? 'jpeg' : imgType[0].toLowerCase();
} else {
throw 'Invalid image type for canvas encoder: ' + img.src;
}

0 comments on commit b636282

Please sign in to comment.