Skip to content

Commit 03a0dba

Browse files
committed
Fix image processing.
1 parent ddfbf21 commit 03a0dba

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

changes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- updated: `controller.view(name/url, [model], [headers], [partial])` can render a view from URL address
55
- updated: `F.backup()` argument `path` can contain `String Array` file list
66
- updated: `controller.viewCompile(body, model, [headers], [partial], [cacheKey])` add a cache key
7+
- updated: `image.command(arg, value, [priority], [escape])` a `priority` argument can be `escape` when it contains `boolean` value
78

89
======= 2.7.0
910

image.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ Image.prototype.save = function(filename, callback, writer) {
203203
filename = filename || self.filename || '';
204204

205205
var command = self.cmd(self.filename ? self.filename : '-', filename);
206+
206207
if (F.isWindows)
207208
command = command.replace(REGEXP_PATH, '\\');
208209

@@ -683,11 +684,17 @@ Image.prototype.make = function(fn) {
683684
};
684685

685686
Image.prototype.command = function(key, value, priority, esc) {
687+
688+
if (priority === true) {
689+
priority = 0;
690+
esc = true;
691+
}
692+
686693
return this.push(key, value, priority || 10, esc);
687694
};
688695

689696
function wrap(command, empty) {
690-
return (empty ? ' ' : '') + D + command.replace(REGEXP_ESCAPE, '') + D;
697+
return (empty ? ' ' : '') + (command === '-' ? command : (D + command.replace(REGEXP_ESCAPE, '') + D));
691698
}
692699

693700
exports.Image = Image;

0 commit comments

Comments
 (0)