mirror of
https://github.com/lovell/sharp.git
synced 2025-07-13 04:20:12 +02:00
Apply correct forced output when chaining #1528
This commit is contained in:
parent
813831acf0
commit
30ca424942
@ -9,6 +9,9 @@ Requires libvips v8.7.0.
|
|||||||
* Prevent mutatation of options passed to `jpeg`.
|
* Prevent mutatation of options passed to `jpeg`.
|
||||||
[#1516](https://github.com/lovell/sharp/issues/1516)
|
[#1516](https://github.com/lovell/sharp/issues/1516)
|
||||||
|
|
||||||
|
* Ensure forced output format applied correctly when output chaining.
|
||||||
|
[#1528](https://github.com/lovell/sharp/issues/1528)
|
||||||
|
|
||||||
#### v0.21.1 - 7<sup>th</sup> December 2018
|
#### v0.21.1 - 7<sup>th</sup> December 2018
|
||||||
|
|
||||||
* Install: support `sharp_dist_base_url` npm config, like existing `SHARP_DIST_BASE_URL`.
|
* Install: support `sharp_dist_base_url` npm config, like existing `SHARP_DIST_BASE_URL`.
|
||||||
|
@ -541,7 +541,9 @@ function tile (tile) {
|
|||||||
* @returns {Sharp}
|
* @returns {Sharp}
|
||||||
*/
|
*/
|
||||||
function _updateFormatOut (formatOut, options) {
|
function _updateFormatOut (formatOut, options) {
|
||||||
this.options.formatOut = (is.object(options) && options.force === false) ? 'input' : formatOut;
|
if (!(is.object(options) && options.force === false)) {
|
||||||
|
this.options.formatOut = formatOut;
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1376,6 +1376,17 @@ describe('Input/output', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Can force output format with output chaining', function () {
|
||||||
|
return sharp(fixtures.inputJpg)
|
||||||
|
.resize(320, 240)
|
||||||
|
.png({ force: true })
|
||||||
|
.jpeg({ force: false })
|
||||||
|
.toBuffer({ resolveWithObject: true })
|
||||||
|
.then(function (out) {
|
||||||
|
assert.strictEqual('png', out.info.format);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('toFormat=JPEG takes precedence over WebP extension', function (done) {
|
it('toFormat=JPEG takes precedence over WebP extension', function (done) {
|
||||||
sharp(fixtures.inputPng)
|
sharp(fixtures.inputPng)
|
||||||
.jpeg()
|
.jpeg()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user