Profile Picture Retrieval
Revision as of 20:23, 5 September 2018 by Pazako Karu (talk | contribs) (Updated to reflect changes to profile html.)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Profile Picture Retrieval by Pazako Karu UPDATED 9/5/18
//Released as Public Domain
//Pazako Karu 9/5/18
key ppReqID;
key ProfilePic;
getProfilePic(key AvatarKey)
{
ppReqID = llHTTPRequest( "http://world.secondlife.com/resident/" + (string)AvatarKey,[HTTP_METHOD,"GET"],"");
}
setProfilePic(key Texture)
{
if (Texture != NULL_KEY)
{
llSetTexture(Texture,ALL_SIDES);
}
else llOwnerSay("Invalid texture returned!");
}
default
{
state_entry()
{
getProfilePic(llGetOwner());
}
http_response(key req,integer stat, list meta, string body)
{
if (req == ppReqID)
{
integer s1 = llSubStringIndex(body,"<meta name=\"imageid\" content=\""); // Find the image in html
ProfilePic = (key)llGetSubString(body,s1+30,s1+65); // After the search text, and for 35 chars is UUID
if(s1 == -1) ProfilePic = NULL_KEY; // If it wasn't found, they have no profile pic
setProfilePic(ProfilePic); // Set the texture
}
}
}