0

I'm trying to show results with a simple display template. But I get a error:

Cannot read property 'getPictureMarkup' of undefined

How do I retrieve images with search result? I was hoping that I could use the same display template as with CSWP, but clearly not :(

var pictureMarkup = Srch.ContentBySearch.getPictureMarkup(pictureURL, 100, 100, ctx.CurrentItem, "cbs-picture3LinesImg", line1, pictureId);

Are the Property mappings the same with search result as with CSWP ?

2

The getPictureMarkup function is only available when using the CSWP. If you want to create a display template to work in both the search result and CSWP, you could better use the following feature: Src.U.getImageSourceWithRendition(picture, width, height).

This function will give you the URL value of the picture managed property with the width and height rendition values: /sites/site1/publishingimages/_88D.jpg?width=100&height=100

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.