Tutorial #006: Fetching and Manipulating Images from Bloomreach

In this video we'll have a look at how to fetch and manipulate images from the Bloomreach DAM using XIN mods. 

Unit-test code: 

 

									const xinmods = require("xinmods");
									
									describe("A simple connecting test to Bloomreach XM", () => {
									
									    it("should connect and get a document", async () => {
									
									        const conn = xinmods.connectTo("http://localhost:8080", "admin", "admin");
									        const doc = await conn.getDocumentByPath("/content/documents/recipes/cupcakes-recipe");
									
									        // console.log(JSON.stringify(doc.items.thumbnail, null, 4));
									
									        // Image instance
									        const thumbnail = await conn.getImageFromLink(doc.items.thumbnail);
									
									        console.log(thumbnail.crop(300, 300).scaleWidth(150).toUrl());
									    });
									
									
									});
									

 

Also Read