none
SharePoint 2016 On Premise - People Search Result Photo Size "MThumb" to LThumb

    Question

  • How do you increase the photo size in the search results page itself, from MThumb to LThumb?

    SharePoint 2016 On Premise - People Search Result Photo Size "MThumb" to LThumb

    The rendering looks like its from Javascript

    <!--#_
                        AddPostRenderCallback(ctx, function(){
                            EnsureScriptFunc("clienttemplates.js", "RenderUserFieldWorker", function() {
                                var getUserPersona = function() {
                                    var renderCtx = new ContextInfo();
                                    renderCtx.Templates = {};
                                    renderCtx.Templates["Fields"] = {};
                                    var fieldSchemaData = { "PictureOnly":"1", "PictureSize": "Size_128px"};
                                    var listSchema = {"EffectivePresenceEnabled": "1", "PresenceAlt": Srch.Res.item_People_NoPresenceAvailable};
                                    var userData = {"title": uName, "email": uEmail, "picture": uPicUrl, "sip": uSip};
                                    var personaControlElement = document.getElementById(userPersonaId);
                                    if (!Srch.U.n(personaControlElement))
                                    {
                                        personaControlElement.innerHTML = RenderUserFieldWorker(renderCtx, fieldSchemaData, userData, listSchema);
                                    }
                                    if (typeof(ProcessImn) != "undefined") { ProcessImn(); }
                                };
                                getUserPersona();
                            });
                        });
    _#-->  

    Steve W


    Tuesday, June 05, 2018 8:38 PM

Answers

  • RESOLVED with the IF NULL and had to add an ELSE clause for a default no photo  :)

                        AddPostRenderCallback(ctx, function(){
                            EnsureScriptFunc("clienttemplates.js", "RenderUserFieldWorker", function() {
                                var getUserPersona = function() {
                                    var renderCtx = new ContextInfo();
                                    renderCtx.Templates = {};
                                    renderCtx.Templates["Fields"] = {};
                                    var fieldSchemaData = { "PictureOnly":"1", "PictureSize": "Size_180px"};
                                    var listSchema = {"EffectivePresenceEnabled": "1", "PresenceAlt": Srch.Res.item_People_NoPresenceAvailable};
                                    if (uPicUrl !== null) {var LPicUrl=uPicUrl.replace("MThumb","LThumb");} else {var LPicUrl = '/images/noPhoto.gif'}
                                    var userData = {"title": uName, "email": uEmail, "picture": LPicUrl, "sip": uSip};    
                                    var personaControlElement = document.getElementById(userPersonaId);
                                    if (!Srch.U.n(personaControlElement))
                                    {
                                        personaControlElement.innerHTML = RenderUserFieldWorker(renderCtx, fieldSchemaData, userData, listSchema);
                                    }
                                    if (typeof(ProcessImn) != "undefined") { ProcessImn(); }
                                };
                                getUserPersona();
                            });
                        });


    Steve W

    Thursday, June 07, 2018 7:11 PM

All replies

  • Hi,

    Sample demo for your reference.

    Custom display template for people search, You could create a custom one, for test purpose, I modify the Item_Person.html(blue part).

    http://www.ableblue.com/blog/archive/2013/06/05/introduction-to-sharepoint-2013-display-templates/


    Code:

    var fieldSchemaData = { "PictureOnly":"1", "PictureSize": "Size_300px"};
                                    var listSchema = {"EffectivePresenceEnabled": "1", "PresenceAlt": Srch.Res.item_People_NoPresenceAvailable};
                                    var LPicUrl=uPicUrl.replace("MThumb","LThumb");
                                    var userData = {"title": uName, "email": uEmail, "picture": LPicUrl, "sip": uSip};

    You need adjust the front-end CSS properly, as OOB CSS has height&width limitation.



    Best Regards,

    Lee


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Wednesday, June 06, 2018 3:33 AM
  • Thanks and it 'mostly' works now!

    When i search again on the same page, after a result set, it throws an error.

    Sorry, something went wrong.

    HIDE DETAILS
    Display Error: The display template had an error. You can correct it by fixing the template or by changing the display template used in either the Web Part properties or Result Types.
    Cannot read property 'replace' of null (OnPostRender: )
     

    Steve W

    Wednesday, June 06, 2018 2:18 PM
  • Hi,

    Try to used developer tool(F12) to debug the script to check is this caused by null object reference, if caused by null object, add condition(if… else…) to check it.

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Thursday, June 07, 2018 1:35 AM
  • Not sure of this error.

                        AddPostRenderCallback(ctx, function(){
                            EnsureScriptFunc("clienttemplates.js", "RenderUserFieldWorker", function() {
                                var getUserPersona = function() {
                                    var renderCtx = new ContextInfo();
                                    renderCtx.Templates = {};
                                    renderCtx.Templates["Fields"] = {};
    var fieldSchemaData = { "PictureOnly":"1", "PictureSize": "Size_180px"};
                                    var listSchema = {"EffectivePresenceEnabled": "1", "PresenceAlt": Srch.Res.item_People_NoPresenceAvailable};
                                    var LPicUrl=uPicUrl.replace("MThumb","LThumb");
                                    var userData = {"title": uName, "email": uEmail, "picture": LPicUrl, "sip": uSip};                                
                                    var personaControlElement = document.getElementById(userPersonaId);
                                    if (!Srch.U.n(personaControlElement))
                                    {
                                        personaControlElement.innerHTML = RenderUserFieldWorker(renderCtx, fieldSchemaData, userData, listSchema);
                                    }
                                    if (typeof(ProcessImn) != "undefined") { ProcessImn(); }
                                };
                                getUserPersona();


    Steve W

    Thursday, June 07, 2018 1:53 PM
  • RESOLVED with the IF NULL and had to add an ELSE clause for a default no photo  :)

                        AddPostRenderCallback(ctx, function(){
                            EnsureScriptFunc("clienttemplates.js", "RenderUserFieldWorker", function() {
                                var getUserPersona = function() {
                                    var renderCtx = new ContextInfo();
                                    renderCtx.Templates = {};
                                    renderCtx.Templates["Fields"] = {};
                                    var fieldSchemaData = { "PictureOnly":"1", "PictureSize": "Size_180px"};
                                    var listSchema = {"EffectivePresenceEnabled": "1", "PresenceAlt": Srch.Res.item_People_NoPresenceAvailable};
                                    if (uPicUrl !== null) {var LPicUrl=uPicUrl.replace("MThumb","LThumb");} else {var LPicUrl = '/images/noPhoto.gif'}
                                    var userData = {"title": uName, "email": uEmail, "picture": LPicUrl, "sip": uSip};    
                                    var personaControlElement = document.getElementById(userPersonaId);
                                    if (!Srch.U.n(personaControlElement))
                                    {
                                        personaControlElement.innerHTML = RenderUserFieldWorker(renderCtx, fieldSchemaData, userData, listSchema);
                                    }
                                    if (typeof(ProcessImn) != "undefined") { ProcessImn(); }
                                };
                                getUserPersona();
                            });
                        });


    Steve W

    Thursday, June 07, 2018 7:11 PM