Here is a fact about LSL, the Linden Scripting Language that drives so many clever and wonderful (and also boring and annoying) things in second Life:
There is no LSL function to allow a script to get or display the profile picture associated with a random Resident’s profile.
But, but, I hear you say, what about all those profile-pic boards in stores and clubs and things that display the profile pics of random vistors (sometimes after asking you for your permission, sometimes not). What about them?
Ah, I reply, those work by some clever hacks, using LSL’s ability to read web pages in order to read some stuff from pages off the web and, in a way that usually happens to work, infer from that the ID of the texture that is the profile pic of a given Resident, which can then be displayed on the face of a prim.
And note the “usually happens to work” in the above. As is clear from a recent JIRA entry, it doesn’t always work, and in fact it has recently stopped working, mostly or somewhat, in various ways.
First, I will natter on a bit about the clever trick that’s used to display profile images. I was amazed when I first saw one, because I knew very well there was no direct LSL “get me the profile image for resident XYZ” function (although it’d be nice if there were).
On the other hand, there is an afaik little-known Web copy of Resident profiles and various other things, on the host world.secondlife.com. I don’t know how you get to them via the Web normally, from say the main SL website, but I do know that if you stick the ID of any Resident who hasn’t turned off “show in search” on their profile, after the URL stem “http://world.secondlife.com/resident/”, you’ll find the Web copy of their profile.
For instance, my SL ID is 8a123731-b0cb-47e7-90c0-6ed49aeaff58, and so if you follow this link you will find the Web copy of my profile.
On that Web copy of my profile there is a Web copy of my profile pic (aren’t I attractive?). If you look at the HTML for the page, or otherwise ask your browser nicely, it will reveal that the URL of the image is something like:
Now that “48cc” thing there looks like an ID itself, and in fact it is, and if you stick a script into a prim that says:
that fortunate prim will be covered by my profile pic.
And now, since LSL does contain a function for reading web pages (well, to be strictly accurate, for reading the first 2048 characters of web pages), it seems that once a script has a Resident’s key (which is easy to get if the Resident is anywhere nearby), it can fetch the Resident’s Web profile page, read that to find the image URL of their profile pic, extract just the key part, and stick it on one or more faces of a prim for display. (Assuming that the image key is always in a recognizable place, and always in the first 2048 characters of the page.)
And that is in fact exactly how they work!
And that “assuming” there is exactly why they recently stopped working. :)
There were actually two reasons these scripts stopped working: first the Lindens did something wrong in their firewall rules or something, and scripts couldn’t get to world.secondlife.com at all to load the profile pages. That seems to have been mostly fixed now, although it’s still happening here and there.
But more fatally, the Lindens also added lotsa juicy shiny fancy eyecandy HTML to the Web profile pages, and that pushed the image URLs out past the 2048 limit, so that scripts couldn’t get them anymore. Whoever made the change seems to have realized that it might cause problems, or just generally got an attack of neatness, because they also added a brand-new line, near the top of the HTML, explicitly giving the key for the Resident’s profile pic, as in:
<meta name=”imageid” content=”48cc0f84-7f35-3013-c05d-eb05237942f7″ />
This is easier to find and read than the messier HTML down where the image is actually loaded, but still it is different, and while it’s easy to change a profile-pic script to read the new one instead of the old one if you happen to be a scripter with some HTML knowledge and the ability to change the script, there are still dozens upon thousands of already-purchased and already-deployed devices out there whose scripts are now broken.
Is this a Horrible Linden Crime? I don’t think so, really. Anyone who wrote a script that depended on this trick would have known they were using an unsupported interface, and that it might fail at any time. As I wrote on the Jira:
For the people who are complaining that they bought things that have stopped working, you should probably complain to the people you bought them from, rather than to the Lindens. And to the people who are complaining that they sold something that then broke, you knew that could happen when you coded to a completely undocumented and unsupported interface.
It’s nice of the Lab to be working on fixing it, but you know very well that they don’t have to.
If you write a script that only works as long as there’s a “q” in column 17 of line 147 of http://www.secondlife.com/, you have only yourself to blame when someday that q changes…
I do hope and expect that the Lab will fix this, and it’s certainly good customer service for them to do so. On the other hand, people who are getting all angry at the lab and acting as though some actually supported interface was needlessly broken… Well, get a grip. :)
And if that seems a little snooty, I also posted a code snippet showing how to fix at least one popular script, and suggested to the Lindens a way that they could extend that “meta” tag a bit to restore at least many of the existing scripts that look for the full image URL to working order again.
’cause I am awesome that way. :)
So that is the current inneresting little story of the broken profile-pic displayers. And if you happen to have a broken profile-pic script (that you can see and edit the code inside of!), and you are one of the first N people to ask me (where N is the point at which I become overwhelmed and run away), I’d be glad to suggest how you might fix it. Just drop me an IM!
Update: According to a previous JIRA, the Lab did do pretty much exactly my backward-compatibility suggestion (before I’d even made it!), back in December. But apparently someone undid it recently. So, hem hem, I’m sure it’ll be fixed any minute now…