Change font size
It is currently Mon Feb 18, 2019 11:20 am

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 2   [ 12 posts ]
Go to page 1, 2  Next
Author Message
 Post subject: Alternative Profile Picture v0.1
PostPosted: Thu Mar 16, 2017 5:25 pm 
Furious Typer
User avatar

Joined: Fri Mar 26, 2010 12:11 pm
Posts: 158
Location: Belgium / Brussels
Alternative Profile Picture v0.1 by djphil (CC-BY-NC-SA 2.0 BE)

PHP : copy/paste this script in get_picture_uuid.php and place it on your web server
{L_CODE}:
<?php
/* Alternative Profil Picture v0.1 by djphil (CC-BY-NC-SA 2.0 BE) */
if (isset($_GET['name']))
{
    libxml_use_internal_errors(true);
    $url = "http://my.osgrid.org";
    $name = str_replace(" ", ".", trim($_GET['name']));

    $dom = new DOMDocument();
    @$dom->loadHTML(file_get_contents($url."/?name=".$name));
    $tags = $dom->getElementsByTagName('img');

    foreach ($tags as $tag)
    {
        $image = explode("/img/", $tag->getAttribute('src'));
        if (isset($image[1]))
        {
            $image = $image[1];
            $uuid = explode(".jpg", $image);
            if (isset($uuid[0])) $uuid = $uuid[0];
            else $uuid = "00000000-0000-0000-0000-000000000000";
            echo trim($uuid);
        }
    }
}
else echo "No direct access ...";
?>

LSL : Rez a primitive and put this script inside
{L_CODE}:
// Alternative Profile Picture v0.1 by djphil (CC-BY-NC-SA 2.0 BE)

key query;
string url = "http://yourserver.com/get_picture_uuid.php";

default
{
    state_entry()
    {
        llSay(PUBLIC_CHANNEL, "Initialisation ...");
        llSetTexture(TEXTURE_BLANK, ALL_SIDES);
    }
   
    touch_start(integer n)
    {
        query = llHTTPRequest(url + "?name=" + llDetectedName(0), [HTTP_METHOD, "GET"], "");
    }

    http_response(key response, integer status, list data, string body)
    {
        if (response == query)
        {
            body = llStringTrim(body, STRING_TRIM);
            if (body == "00000000-0000-0000-0000-000000000000") llResetScript();
            llSetTexture(body, ALL_SIDES);
        }
    }
}

Enjoy!

_________________
Webmaster @ digitalconcepts.free.fr & digigrids.free.fr


Last edited by dj phil on Wed Oct 03, 2018 11:55 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Alternative Profile Picture v0.1
PostPosted: Mon Mar 20, 2017 12:08 pm 

Joined: Tue Mar 14, 2017 10:54 am
Posts: 12
Thanks for this. I will give it a try.

Have you seen or heard of a direct method that can be used?

Amber-Marie


Top
 Profile  
 
 Post subject: Re: Alternative Profile Picture v0.1
PostPosted: Tue Mar 21, 2017 12:21 pm 
User avatar

Joined: Thu Mar 19, 2015 9:52 am
Posts: 29
The following method will work with OsGrid residents, but not for hypergrid visitors. That is because there is no standardized way in OpenSim to obtain a profile pic from the resident's grid of origin.

So drop this script in a box and click it:

{L_CODE}:
FetchProfilePic(string sName)
{
    integer space = llSubStringIndex(sName, " ");
    string sFirstName = llGetSubString(sName, 0, space-1);
    string sLastName = llGetSubString(sName, space+1, -1);
       
    string RESIDENT_URL = "http://my.osgrid.org/?name=" + sFirstName + "." + sLastName;
    llHTTPRequest(RESIDENT_URL, [HTTP_METHOD,"GET"], "");
}

default
{
    touch_end(integer num_detected)
    {
        FetchProfilePic(llDetectedName(0));
    }
   
    http_response(key request_id,integer status, list metadata, string body)
    {
        // Parse profile pic UUID from OsGrid webprofile
        string sProfilePhotoUUID = (string)NULL_KEY;
        integer start = llSubStringIndex(body,"<img src=\"/img/");
        if (start != -1) {
            start += llStringLength("<img src=\"/img/");
            sProfilePhotoUUID = llGetSubString(body, start, start+35);
        }
       
        // No photo found for resident, select a 'no photo' texture
        if (sProfilePhotoUUID==(string)NULL_KEY)
            sProfilePhotoUUID = "9faab849-5428-48d6-b973-07dfcb70628b";

        // Finally display it if the UUID is valid
        if (osIsUUID(sProfilePhotoUUID))
            llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TEXTURE, ALL_SIDES, sProfilePhotoUUID, <1,1,0>, <0,0,0>, 0]);
    }
}


Top
 Profile  
 
 Post subject: Re: Alternative Profile Picture v0.1
PostPosted: Mon Jan 08, 2018 8:36 pm 
Site Admin
User avatar

Joined: Sun Jun 27, 2010 10:34 am
Posts: 141
Location: France
added in the main of server please call directly http://profiles.osgrid.org/get_picture_uuid.php

_________________
Paela Argus,
Webmanagement Osgrid

https://www.osgrid.org


Top
 Profile  
 
 Post subject: Re: Alternative Profile Picture v0.1
PostPosted: Mon Jan 08, 2018 8:49 pm 
Furious Typer
User avatar

Joined: Fri Mar 26, 2010 12:11 pm
Posts: 158
Location: Belgium / Brussels
Specify the correct syntax
get_picture_uuid.php?name=Firstname Lastname
(Here no point between First and Last).

Also do not confuse:
http://profiles.osgrid.org/get_picture_uuid.php?name=First Last
(who returns profile picture uuid)
and
https://my.osgrid.org/pictureprofile.php?name=First.Last
(who returns profile picture)

_________________
Webmaster @ digitalconcepts.free.fr & digigrids.free.fr


Top
 Profile  
 
 Post subject: Re: Alternative Profile Picture v0.1
PostPosted: Sat Jan 20, 2018 11:41 am 
Furious Typer
User avatar

Joined: Fri Mar 26, 2010 12:11 pm
Posts: 158
Location: Belgium / Brussels
paela argus {L_WROTE}:
added in the main of server please call directly http://profiles.osgrid.org/get_picture_uuid.php

Is dead ? :roll:

_________________
Webmaster @ digitalconcepts.free.fr & digigrids.free.fr


Top
 Profile  
 
 Post subject: Re: Alternative Profile Picture v0.1
PostPosted: Sat Jan 20, 2018 4:24 pm 
Site Admin

Joined: Sun Jul 04, 2010 8:20 pm
Posts: 480
It might be.. we moved to a new host


Top
 Profile  
 
 Post subject: Re: Alternative Profile Picture v0.1
PostPosted: Sun Jan 21, 2018 2:25 am 
Site Admin
User avatar

Joined: Sun Jun 27, 2010 10:34 am
Posts: 141
Location: France
fixed

_________________
Paela Argus,
Webmanagement Osgrid

https://www.osgrid.org


Top
 Profile  
 
 Post subject: Re: Alternative Profile Picture v0.1
PostPosted: Mon Aug 27, 2018 2:07 pm 
Site Admin
User avatar

Joined: Sun Jun 27, 2010 10:34 am
Posts: 141
Location: France
get_picture_uuid.php moved in
http://helper.osgrid.org/get_picture_uuid.php

We have closed the virtual host of old think profile
I will make later a rewrite url for old scripts running old link
but all new script need use the new url thanks you

_________________
Paela Argus,
Webmanagement Osgrid

https://www.osgrid.org


Top
 Profile  
 
 Post subject: Re: Alternative Profile Picture v0.1
PostPosted: Wed Oct 31, 2018 9:57 am 
User avatar

Joined: Mon Oct 10, 2011 11:54 pm
Posts: 22
Hi
I just tried DJ Phil's code and it doesn't work. It fails silently. I haven't been able to determine why. Maybe Opensim changes since his code was posted have rendered it obsolete. Shame. I can't find anything that works across grids.

Frankie.

_________________
Frankie
Honour thy error as a secret intention.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 2   [ 12 posts ]
Go to page 1, 2  Next


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net