August 2016
Intermediate to advanced
376 pages
6h 33m
English
Besides we storing files on Cloudinary, we can use a powerful API to manipulate and transform images, apply effects, resize, and do a lot more things without using any software on our machine.
Let's go back to the books.js controller to check what we used. We extracted the extra code inside the promises function to focus on the highlighted lines of code:
cloudinary.uploader.upload(imageFile,
{
tags: 'photobook',
folder: req.body.category + '/',
public_id: req.files.image.originalFilename
// eager: {
// width: 280, height: 200, crop: "fill", gravity: "face"
// }
})
.then(function (image) {
...
})
.then(function (photo) {
...
})
.finally(function () {
...
});
Here we set up a folder, folder: req.body.category, to store our images, ...
Read now
Unlock full access