Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

for matching example.png.JPG as jpeg #1

Merged
merged 2 commits into from Oct 26, 2011
Jump to file or symbol
Failed to load files and symbols.
+2 −2
Split
@@ -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;
}