-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support query string parameters in URLs #6
Comments
Solution:
|
@mikolalysenko What do you think? |
I think this is a good idea, if you implement it in a PR I will merge. |
Hi,
|
@joernroeder I just submitted a PR that fixes some of the issues with HTTP support. It looks like the Http.IncomingMessage API doesn't support .getHeader any longer, but instead exposes .headers. I also found that if you don't explicitly set encoding:null on the request options, the body doesn't come back encoded as the parsing libraries expect. |
Hi guys. I too ran into similar problem: getPixels('animated.gif?1430103876000',function(error,pixels){
console.log(pixels.shape.length===3)// true
}); As Mr.scottsd stated, Backward match is not work. e.g. $ node var path= require('path')
function getPixels(url, type, cb) {
if(!cb) {
cb = type
type = ''
}
var ext = path.extname(url.toString().split('?')[0]) // Fixed
switch(type || ext.toUpperCase()) {
case '.GIF':
// httpGif(url, cb)
return 'gif'
break
default:
if(Buffer.isBuffer(url)) {
url = 'data:' + type + ';base64,' + url.toString('base64')
}
if(url.indexOf('data:image/gif;') === 0) {
// dataGif(url, cb)
return 'gif'
} else {
// defaultImage(url, cb)
return 'default'
}
}
}
getPixels('http://www.sammobile.com/wp-content/uploads/2013/02/pixel-density-xperias.jpg?v=1')
// 'default'
getPixels('animated.gif')
// 'gif'
getPixels('animated.gif?1430103876000')
// 'gif'
getPixels('data:image/gif;')
// 'gif'
getPixels(new Buffer(''))
// 'default' |
When trying to opening an URL such as
it gives
Please support query string parameters. Some CDNs upload images in the same location, but with a new parameter to show the updated version.
The text was updated successfully, but these errors were encountered: