Skip to content

Conversation

naholyr
Copy link

@naholyr naholyr commented Oct 18, 2013

Automatically convert to given extension using following syntax:

imageVersions: {
  thumbnail: {
    width: 80,
    height: 80,
    extension: "png"
  }
}

Automatically convert to given extension using following syntax:

```javascript
imageVersions: {
  thumbnail: {
    width: 80,
    height: 80,
    extension: "png"
  }
}
```
@yorele
Copy link

yorele commented Mar 29, 2016

the res.json() is a valid issue.

As for extension, you can do this directly with the uploader.on('begin'): changing the extension on the file name there and imageMagick will do the conversion for you if the extension is set.

uploader.on('begin', function (fileInfo, req, res) {
    fileInfo.name = xxxxx; //<--- set the extension the way you want here.
});

You can also set all sorts of options with the imageArgs option:
Like here I crop centered the image to 150x150

imageVersions: {
        small: {
            width: "150",
            height: "150^",
            imageArgs: ['-gravity', 'Center', '-crop', '150x150+0+0', '-format', 'JPG']
        }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants