I've got a search results web part on a page, targeting a document library with .gif and .png files, but getPreviewSrc returns a different value from getUrl (preview returns an image from outside of that library). Editing the Card Info template and changing getPreviewSrc breaks the web part, showing nothing on it. Any workaround so that the correct image loads on the previewImg div?

<div class="ms-Grid-col ms-sm12 ms-md6 ms-lg4">
                        <div class="singleCard">
                            <a href="{{getUrl item}}">
                                <div class="previewImg lazy" data-bg="url('{{getPreviewSrc item}}')" style="background-position: 50% 50%; transform: translate3d(0px, 0px, 0px);">
                            <li class="ms-ListItem ms-ListItem--document" tabindex="0">
                                <div class="cardInfo">
                                    <span class="ms-ListItem-primaryText"><a href="{{getUrl item}}">{{Filename}}</a></span>
                                    <div class="ms-ListItem-selectionTarget"></div>

2 Answers 2


Found a possible fix. Replace {{getPreviewSrc item}} with {{PictureThumbnailURL}}


I use PictureURL in JavaScript apps and in Display Templates. It would give you the full sized image instead of the thumbnail.

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.