immp
Advanced tools
Comparing version 1.1.4 to 1.2.0
{ | ||
"name": "immp", | ||
"description": "Image Manipulation Middleware Proxy", | ||
"version": "1.1.4", | ||
"version": "1.2.0", | ||
"repository": "garrows/IMMP", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -130,2 +130,20 @@ var _ = require('underscore'), | ||
//Get original content-type | ||
function (_callback) { | ||
gmImage.format({ | ||
bufferStream: true | ||
}, function (_error, _format) { | ||
if(_error) { | ||
console.log(_error); | ||
return _callback(_error); | ||
} | ||
image.format = _format; | ||
_res.set({ | ||
'Content-Type': 'image/' + _format.toLowerCase() | ||
}); | ||
_callback(null); | ||
}); | ||
}, | ||
// Crop | ||
@@ -190,3 +208,3 @@ function (_callback) { | ||
//Stream it back. | ||
gmImage.stream(function (_error, _stdout, _stderr) { | ||
gmImage.autoOrient().stream(function (_error, _stdout, _stderr) { | ||
if(_error) { | ||
@@ -221,2 +239,2 @@ console.log(_error); | ||
} | ||
} | ||
} |
@@ -41,2 +41,4 @@ var async = require('async'), | ||
_httpResponse.headers['content-type'].should.eql('image/jpeg'); | ||
gm(_httpResponse) | ||
@@ -62,2 +64,4 @@ .options(gmOptions) | ||
_httpResponse.headers['content-type'].should.eql('image/jpeg'); | ||
gm(_httpResponse) | ||
@@ -83,2 +87,4 @@ .options(gmOptions) | ||
_httpResponse.headers['content-type'].should.eql('image/jpeg'); | ||
gm(_httpResponse) | ||
@@ -105,2 +111,4 @@ .options(gmOptions) | ||
_httpResponse.headers['content-type'].should.eql('image/jpeg'); | ||
gm(_httpResponse) | ||
@@ -127,2 +135,4 @@ .options(gmOptions) | ||
_httpResponse.headers['content-type'].should.eql('image/jpeg'); | ||
gm(_httpResponse) | ||
@@ -151,2 +161,4 @@ .options(gmOptions) | ||
_httpResponse.headers['content-type'].should.eql('image/jpeg'); | ||
gm(_httpResponse) | ||
@@ -173,2 +185,4 @@ .options(gmOptions) | ||
_httpResponse.headers['content-type'].should.eql('image/jpeg'); | ||
gm(_httpResponse) | ||
@@ -196,2 +210,4 @@ .options(gmOptions) | ||
_httpResponse.headers['content-type'].should.eql('image/jpeg'); | ||
gm(_httpResponse) | ||
@@ -218,2 +234,4 @@ .options(gmOptions) | ||
_httpResponse.headers['content-type'].should.eql('image/jpeg'); | ||
gm(_httpResponse) | ||
@@ -245,2 +263,4 @@ .options(gmOptions) | ||
_httpResponse.headers['content-type'].should.eql('image/jpeg'); | ||
gm(_httpResponse) | ||
@@ -262,2 +282,4 @@ .options(gmOptions) | ||
_httpResponse.headers['content-type'].should.eql('image/jpeg'); | ||
gm(_httpResponse) | ||
@@ -283,2 +305,24 @@ .options(gmOptions) | ||
it('should respect the orientation information', function (_done) { | ||
this.slow(5000); | ||
this.timeout(10000); | ||
http.get('http://localhost:3000/im/?image=/images/Landscape_8.jpg&quality=50', function (_httpResponse) { | ||
_httpResponse.headers['content-type'].should.eql('image/jpeg'); | ||
gm(_httpResponse) | ||
.options(gmOptions) | ||
.size(function (_error, _size) { | ||
if(_error) return _done(_error); | ||
_size.width.should.equal(600); | ||
_size.height.should.equal(450); | ||
_done(); | ||
}); | ||
}); | ||
}); | ||
it('should work for http images', function (_done) { | ||
@@ -290,2 +334,4 @@ this.slow(5000); | ||
_httpResponse.headers['content-type'].should.eql('image/jpeg'); | ||
gm(_httpResponse) | ||
@@ -312,2 +358,4 @@ .options(gmOptions) | ||
_httpResponse.headers['content-type'].should.eql('image/png'); | ||
gm(_httpResponse) | ||
@@ -326,4 +374,6 @@ .options(gmOptions) | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
19195
445