Profile Picture Code Broken
|
Celty Westwick
Registered User
Join date: 24 Jun 2006
Posts: 145
|
11-23-2009 13:50
This code had worked for weeks until and suddenly will generate an error for the profile picture for any avatar except me. string URL_RESIDENT = "http://world.secondlife.com/resident/"; default { touch_start(integer p) { llHTTPRequest( URL_RESIDENT + (string)llDetectedKey(0),[HTTP_METHOD,"GET"],""); }
http_response(key req,integer stat, list met, string body) { llSetTexture((key)llGetSubString(body,llSubStringIndex(body,"< img alt=\"profile image\" src=\"http://secondlife.com/app/image/")+llStringLength("< img alt=\"profile image\" src=\"http://secondlife.com/app/image/"),llSubStringIndex(body,"\" class=\"parcelimg\" /> ")-3),ALL_SIDES); }
}
The failure gives this message.. "Object: Could not find texture 'N" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> < html xmlns="http://www.w3.org/1999/xhtml"> < head> < meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> < title>jamie Chee " (in that message the avatar name is missing 2 letters from the last name) Any thoughts why something changed when the same code worked before?
|
IBME Swindlehurst
Registered User
Join date: 5 Mar 2007
Posts: 139
|
11-23-2009 15:34
Celty - I've tried to look at your code, and there is at least one obvious error in the code you posted (a space between the I and ndex). I'm not sure where all I am supposed to replace "X's" with either "<" or a ">". Can you either send me the code that used to work or better yet post a corrected version here so that anyone else can help?
|
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
|
11-23-2009 16:31
That space between "I" and "ndex" is a bogey. It's not in the original code itself ... it's one of those things that the forum software does. The "< " and ">" brackets aren't the problem either. (BTW, you can post fine with them. Just be sure that an open bracket is followed by either a digit or a space.)
It looks to me as if something is borked on LL's end. I have been using Debbie Trilling's script to grab a profile pic for a long time. I just checked in world, though, and it's kicking up an error too. LL messed with their URL earlier this year and then replaced the "improvement" with the original version. My guess is that they've done it again.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask....  Look for my work in XStreetSL at 
|
Celty Westwick
Registered User
Join date: 24 Jun 2006
Posts: 145
|
11-23-2009 17:04
Thanks, I edited the post it worked, hmm frustrating when something that worked is broken by Lindens without even a BTW, any suggestions?
|
IBME Swindlehurst
Registered User
Join date: 5 Mar 2007
Posts: 139
|
11-23-2009 18:17
Yes, it's broken - See WEB-1384 in the JIRA 
|
Celty Westwick
Registered User
Join date: 24 Jun 2006
Posts: 145
|
11-23-2009 19:48
Indeed - Linden's strike again..
|
ab Vanmoer
Registered User
Join date: 28 Nov 2006
Posts: 131
|
11-23-2009 22:23
As unlikely as it may seem, whomever made the changes that broke the profile picture code, was probably completely unaware that their change had any other side effects.
A few months back LL changed the search URL from http ://search.secondlife.com/client_search.php to vwrsearch.secondlife.com
I contacted Liana Linden in-world who told me that they do not officially support external use of the search URLs however they do not prohibit the use either, although she didn't see why anyone would want to use them. She was actually quite surprised when I told her that using search is a convenient way of doing name to key lookup. Once she realised that there is a valid use, she assured me that for the foreseeable future there would be no more changes to the search URL and if it becomes necessary LL will try and provide as much warning as possible.
|
ElQ Homewood
Sleeps Professionally
Join date: 25 Apr 2007
Posts: 280
|
11-24-2009 01:30
Ok I just about freaked out..mine's working fine
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
11-24-2009 01:58
Give this version a try, it grabs the texture UUID from an earlier point in the page. string URL_RESIDENT = "http://world.secondlife.com/resident/"; string gProfileLookFor;
default {
// assigning gProfileLookFor this weird way in state_entry just to get around // the forum filter :p Feel free to move it up top and get rid of the + operator. state_entry() { gProfileLookFor = "<" + "meta name=\"imageid\" content=\""; } touch_start(integer p) { llHTTPRequest( URL_RESIDENT + (string)llDetectedKey(0),[HTTP_METHOD,"GET"],""); }
http_response(key req,integer stat, list met, string body) { integer textureStart = llSubStringIndex(body, gProfileLookFor) + llStringLength(gProfileLookFor); llSetTexture(llGetSubString(body, textureStart, textureStart + 35), ALL_SIDES); }
}
|
Celty Westwick
Registered User
Join date: 24 Jun 2006
Posts: 145
|
11-24-2009 07:24
Thanks Viktoria, I'll try it 
|
Celty Westwick
Registered User
Join date: 24 Jun 2006
Posts: 145
|
11-24-2009 13:45
Tried it thanks very much it worked 
|
Viktoria Dovgal
…
Join date: 29 Jul 2007
Posts: 3,593
|
11-24-2009 13:53
Yay. I see the JIRA entry was imported, so don't be too surprised if you have to change it again some day.
One note: web scrapers using that tag will want to check if the returned string is NULL_KEY (that's the value for no profile image) and substitute or skip on that case.
|
Ken Gearhead
Registered User
Join date: 6 Aug 2009
Posts: 1
|
Fixed!!
12-03-2009 22:21
http://jira.secondlife.com/browse/WEB-1383They moved the IMG tag up the page to fall within the 2048 byte limit. See, it helps to bring this stuff up to LL. Sometimes they listen, and they even fix it!! If you happen to use profile textures a lot in your scripts, take a minute to vote for the addition of a function that would allow the direct query of a profile texture without scraping a web page for it.. http://jira.secondlife.com/browse/SVC-5096
|