Talk:LibraryDisplayLandScreenshot
This script seems to be no longer working since the page it accesses has been altered to a point that the script can no longer handle the change. —The preceding unsigned comment was added on 03:43, 24 May 2014 by Fritigern Gothly
- Yep, looks pretty dead. The imageid meta tag is toast, and all the added banner gunk pushes the <img> tag past 16K. User-agent spoofing almost looked like it would save the day, but the banner gunk is still there, just hidden. --Cerise Sorbet 17:57, 24 May 2014 (PDT)
- and bibbidi-bobbidi-boo! BUG-6151 --Cerise Sorbet 19:47, 24 May 2014 (PDT)
- Below should work :
<lsl> // Credit goes to Jana Kamachi/Solar Alter // for discovering this concept first // and taking it beyond just displaying the profile picture // see http://forums.secondlife.com/showthread.php?t=225460 // and https://wiki.secondlife.com/wiki/User:Jana_Kamachi/Profile // for further information
/*
Modified by Jon Desmoulins to use the new PARCEL_DETAILS_ID to fetch the image that displays on the world.secondlife.com pages It's a little hacky, but it works.
- /
string gLandUrl = "http://world.secondlife.com/place/"; //Base URL for world search
ResetTextures()
{
llSetTexture(TEXTURE_BLANK, ALL_SIDES);
}
default {
state_entry() { ResetTextures(); } touch_start(integer num_detected) { string parcelID = (string)llList2Key(llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_ID]), 0); string worlURL = gLandUrl + parcelID;
// We are going to call YQL yahoo API to fetch world.secondlife.com and parse the HTML page // YQL can give XML answer or JSON answer . // As we can easier parse JSON answers we request JSON answer
string requestYQL = llEscapeURL("select src from html where url=\"") + worlURL + llEscapeURL("\"" ) + llEscapeURL(" and xpath='//img[@class=\"parcelimg\"]'");
// The Xpath rule means : Inside all the HTML document from world.secondlife.com , // give me the img attributes who have // an attribute class named parcelimg // From these answers give me the src value of the img
string requestREST = "http://query.yahooapis.com/v1/public/yql?q=" + (requestYQL) + "&format=json&callback="; llHTTPRequest(requestREST, [], ""); } on_rez(integer start_param) { ResetTextures(); } http_response(key request_id,integer status, list metadata, string body) {
if (status == 200) {
// We have requested the answer in the JSON Format // We parse the JSON answer to grab our answer
string urlImage = llJsonGetValue ( body, [ "query" , "results" , "img", "src" ] ); if ( urlImage != JSON_INVALID ) { key UUIDImage = (key)llGetSubString(urlImage, -38, -3 ); if ( UUIDImage != NULL_KEY ) { llOwnerSay("Found parcel image " + (string)UUIDImage); llSetTexture(UUIDImage, ALL_SIDES); } } else { llOwnerSay("Could not retrieve parcel page, parcel not found"); ResetTextures(); }
} else if ( status == 400 )
// YQL return error 400 and fills field errors when the YQL request is invalid ; // We are grabbing the error
{ llOwnerSay("Could not retrieve parcel page, error YQL"); if ( llJsonValueType ( body, [ "error" , "description"] ) == JSON_STRING ) { llOwnerSay( llJsonGetValue ( body, [ "error" , "description" ] )); } ResetTextures(); } else // other errors ( network .. etc ... ) { llOwnerSay("Could not retrieve parcel page, error HTTP"); llOwnerSay(llList2CSV(["Error HTTP", status])); ResetTextures(); } }
} </lsl> Miranda Umino 20:15, 28 May 2014 (PDT)