Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > DEVELOPMENT > Hacks and Modifications

Post Reply
 
Thread Tools
  #11  
Old 08-21-2005, 05:12 AM
blinking8s's Avatar
blinking8s+ Offline
über loafer
 
Join Date: Oct 2004
Location: Bowling Green, Ky
Posts: 3,428
Send a message via ICQ to blinking8s Send a message via AIM to blinking8s Send a message via MSN to blinking8s Send a message via Skype™ to blinking8s
i think its cool yo!
__________________
i should say more clever stuff
Reply With Quote
  #12  
Old 08-21-2005, 07:11 AM
Connie
Guest
 
Posts: n/a
yes, I wanted to know what GRAVATARS are....
Reply With Quote
  #13  
Old 08-21-2005, 10:30 PM
derevaun Offline
pp regular
 
Join Date: Mar 2005
Location: oly, wa
Posts: 47
I've updated, if not improved, the code in functions.php. First, I added a function that may or may not net more favicons, copied directly from http://www.peej.co.uk/projects/favatars.html

Code:
function getFavicon($url) {
 $HTTPRequest = @fopen($url, 'r'); 
 if ($HTTPRequest) {
  stream_set_timeout($HTTPRequest, 0.1);
  $html = fread($HTTPRequest, 4096); 
  $HTTPRequestData = stream_get_meta_data($HTTPRequest); 
  fclose($HTTPRequest); 
  if (!$HTTPRequestData['timed_out']){
   if (preg_match('/<link[^>]+rel="(?:shortcut )?icon"[^>]+?href="([^"]+?)"/si',$html, $matches)) { 
    $linkUrl = html_entity_decode($matches[1]); 
    if (substr($linkUrl, 0, 1) == '/') {
     $urlParts = parse_url($url); 
     $faviconURL = $urlParts['scheme'].'://'.$urlParts['host'].$linkUrl; 
    } elseif (substr($linkUrl, 0, 7) == 'http://') {
     $faviconURL = $linkUrl; 
    } elseif (substr($url, -1, 1) == '/') {
     $faviconURL = $url.$linkUrl; 
    } else { $faviconURL = $url.'/'.$linkUrl; 
    } 
   } else {
    $urlParts = parse_url($url); 
    $faviconURL = $urlParts['scheme'].'://'.$urlParts['host'].'/favicon.ico'; 
   } 
   $HTTPRequest = @fopen($faviconURL, 'r'); 
   if ($HTTPRequest) {
    stream_set_timeout($HTTPRequest, 0.1); 
    $favicon = fread($HTTPRequest, 8192); 
    $HTTPRequestData = stream_get_meta_data($HTTPRequest); 
    fclose($HTTPRequest); 
    if (!$HTTPRequestData['timed_out'] && strlen($favicon) < 8192) {
     return $faviconURL; 
    } 
   } 
  } 
 } 
 return false; 
}
...then changed some script to replace the gravatar with a favatar if there's one

Code:
if($comment_url != "") {
  $comment_url = "http://$comment_url"; 
  $comment_url = str_replace("http://http://","http://",$comment_url); 
  $grav_url="http://www.gravatar.com/avatar.php?gravatar_id=".md5($comment_email)."&amp;amp;size=16"; 
  $fav_url = getFavicon($comment_url);
  $av_url = $grav_url;
  if ($fav_url) {
    $av_url = $fav_url;
  }
  $comment_name = "<a href='$comment_url' title='$lang_visit_homepage' target='_blank'><img src='$av_url' />$comment_name</a>";
}
It's still flaky: where there is a favicon, I can reload and it alternates between returning the favicon url and returning false. I can't think of a way to test the presence of the gravatar before using it, so I'm stuck with inserting an image even if there's nothing for its src. But it's a start! Any insights?
__________________
http://asiftosay.com
Reply With Quote
  #14  
Old 08-22-2005, 02:03 AM
wiphey Offline
forum loafer
 
Join Date: May 2005
Posts: 5
Send a message via AIM to wiphey
I'm not a big fan of favatars, they're too small. A lot of people use gravatars now so the first version you made was simple for me to integrate.
Reply With Quote
  #15  
Old 08-22-2005, 08:58 AM
Connie
Guest
 
Posts: n/a
Please,

do these things in AddOns, users will not be able to follow that when they update PixelPost

we have AddOns there, we do not want Hacks and modifications anymore as the support for users will be too difficult in case they update the official version...

because of compatibility, do these things in AddOns
Reply With Quote
  #16  
Old 08-22-2005, 05:37 PM
Joe[y]'s Avatar
Joe[y]+ Offline
Team Pixelpost
 
Join Date: Mar 2005
Location: UK
Posts: 3,101
Send a message via MSN to Joe[y]
could have sworn there was a favator addon i used a while back which worked super! till i accidently lost it updating version.
Reply With Quote
  #17  
Old 08-26-2005, 07:12 AM
derevaun Offline
pp regular
 
Join Date: Mar 2005
Location: oly, wa
Posts: 47
OK, I've made an addon for gravatars : http://forum.pixelpost.org/showthread.php?p=13411 . If there's interest, I'll try to make one for favatars too.
__________________
http://asiftosay.com
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 11:45 AM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs