2

original question that wont let me comment on or expand on...

How to store user profile photo in list using Microsoft Flow?

How did you get the code <img src="data:content-type-value;content-value"> to work?

I am using this to pass the photo info from a SP list into a Ticker with spservices.

"PhotoContentType" gets $content-type passed to it and "Picture" gets the $content passed to it.

$().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "NewUsers",
    webURL: "/sites/CFFIntranet",
    CAMLViewFields: "<ViewFields><FieldRef Name='Title' /><FieldRef Name='Created' /><FieldRef Name='Department' /><FieldRef Name='Location' /><FieldRef Name='Picture' /><FieldRef Name='PhotoContentType' /></ViewFields>",
    completefunc: function (xData, Status) {

    console.log(Status);
    console.log("GetListItems operation: " + xData.responseText);

    $(xData.responseXML).SPFilterNode("z:row").each(function() {  

            var PhotoContentType = $(this).attr("ows_PhotoContentType");         
            var Picture = $(this).attr("ows_Picture");
            var Name = $(this).attr("ows_Title");
            var Created = $(this).attr("ows_Created");
            var Department = $(this).attr("ows_Department");
            var Location = $(this).attr("ows_Location");
            var fixedDate = convertDateSlashFormat(Created);


            var NewUL = "<li> <img src='data:"+PhotoContentType+";"+Picture+"'/>  "+Name+" "+Department+"</li>";                    
            $("#NewEmpTickerUL").append(NewUL);


            });
        }
        });
1

I found by changing:

var NewUL = "<li> <img src='data:"+PhotoContentType+";"+Picture+"'/> "+Name+" "+Department+"</li>"; $("#NewEmpTickerUL").append(NewUL);

to:

var NewUL = "<li> <img src='data:"+PhotoContentType+";base64,"+Picture+"'/> "+Name+" "+Department+"</li>"; $("#NewEmpTickerUL").append(NewUL);

The picture will show correctly.

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.