2

I have a requirement where there will be a single Picture Library for the entire application and all application images will be there, I want a URL column in the Picture Library View where user can copy the URL and use it for certain functionalities.

2
  • Will you be able to use workflows (SharePoint Designer, Nintex)? Commented Sep 22, 2017 at 19:25
  • no i cannot use workflows Commented Sep 26, 2017 at 4:28

1 Answer 1

3

One option is to use JSLink to populate the image Url. Create a column called "ImageUrl" and use below script to populate the field value.

(function () {

var imageUrlFiledTemplateContext = {};
imageUrlFiledTemplateContext.Templates = {};
imageUrlFiledTemplateContext.Templates.Fields = {

    'ImageUrl': { 'View': ImageUrlFiledTemplate }
};

SPClientTemplates.TemplateManager.RegisterTemplateOverrides(imageUrlFiledTemplateContext);

})();

function ImageUrlFiledTemplate(ctx) {
    var imageUrl = _spPageContextInfo.webAbsoluteUrl + ctx.listUrlDir + "/" + ctx.CurrentItem.FileLeafRef;
    return imageUrl;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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