TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack (13) Thread Tools Search this Thread Display Modes
Old 06-18-2008, 01:14 PM   #21 (permalink)
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 353
Thanks: 8
Kalle is on a distinguished road
Default

Quote:
Originally Posted by Wildhoney View Post
I must admit, I don't understand that error. The only thing I can think of is that type-casting wasn't available in PHP 4? It's a while since I used it so I have completely forgotten. Any help would be appreciated.

The function setSize looks like the following:

php Code:
public function setSize($iSize)
{
    $this->m_iSize = (int) $iSize;
    return $this;
}
Type casting was available as of PHP4, however it might be the new PHP5 keywords causing the error, even though I would expect an "Unexpected T_STRING" insted
__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote
Old 06-18-2008, 01:42 PM   #22 (permalink)
The Wanderer
 
ciprianmp's Avatar
 
Join Date: Jun 2008
Location: Bucharest, Romania
Posts: 14
Thanks: 6
ciprianmp is on a distinguished road
Arrow -> setSize(80) - fix for php4

Quote:
Originally Posted by Kalle View Post
Type casting was available as of PHP4, however it might be the new PHP5 keywords causing the error, even though I would expect an "Unexpected T_STRING" insted
That error came up on a php 4.3.11 server. Afterwards, I saw that server doesn't accept remote access for file(), file_exists(), is_file() or filesize() functions (allow_url_fopen is "On" though)

It had sometihng to do with the format of the class call:
PHP Code:
 $pAvatar = new TalkPHP_Gravatar();
 echo 
$pAvatar -> setEmail('example@example.com')
     -> 
setSize(80)
     -> 
setRating(GRAVATAR_RATING_PG)
     -> 
getAvatar(); 
threw the error on that server, while there is no error anymore after changing it to:
PHP Code:
$pAvatar = new TalkPHP_Gravatar();
   
$pAvatar->setEmail('example@example.com');
   
$pAvatar->setSize(80);
   
$pAvatar->setRating(GRAVATARS_RATING_PG);
   echo 
$pAvatar->getAvatar(); 
As you can see, it works fine now on Latest Developing version - phpMyChat-Plus (4.3.11 server)

PS: does anyone know what could be the disabled setting which makes file, file_exists, filesize and is_file not to work with remote files? They work just fine with local files though...

Last edited by ciprianmp : 09-10-2008 at 07:02 AM.
ciprianmp is offline  
Reply With Quote
Old 12-05-2008, 03:35 PM   #23 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,215
Thanks: 90
Wildhoney is on a distinguished road
Default

I made some minor changes to this script as it's so popular. Could you please report any bugs in this thread. Thank you!
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 12-06-2008, 12:41 PM   #24 (permalink)
The Frequenter
Zend Certified 
 
Join Date: Sep 2007
Location: Denmark
Posts: 353
Thanks: 8
Kalle is on a distinguished road
Default

Quote:
Originally Posted by ciprianmp View Post
That error came up on a php 4.3.11 server. Afterwards, I saw that server doesn't accept remote access for file(), file_exists(), is_file() or filesize() functions (allow_url_fopen is "On" though)

It had sometihng to do with the format of the class call:
PHP Code:
 $pAvatar = new TalkPHP_Gravatar();
 echo 
$pAvatar -> setEmail('example@example.com')
     -> 
setSize(80)
     -> 
setRating(GRAVATAR_RATING_PG)
     -> 
getAvatar(); 
threw the error on that server, while there is no error anymore after changing it to:
PHP Code:
$pAvatar = new TalkPHP_Gravatar();
   
$pAvatar->setEmail('example@example.com');
   
$pAvatar->setSize(80);
   
$pAvatar->setRating(GRAVATARS_RATING_PG);
   echo 
$pAvatar->getAvatar(); 
As you can see, it works fine now on Latest Developing version - phpMyChat-Plus (4.3.11 server)

PS: does anyone know what could be the disabled setting which makes file, file_exists, filesize and is_file not to work with remote files? They work just fine with local files though...
After thinking it over again I remember why the error comes up, it was because PHP4 didn't support method chaining.

Quote:
Originally Posted by Wildhoney View Post
I made some minor changes to this script as it's so popular. Could you please report any bugs in this thread. Thank you!
Good stuff Adam :)
__________________
Send a message via MSN to Kalle Send a message via Skype™ to Kalle
Kalle is offline  
Reply With Quote
Old 12-06-2008, 04:21 PM   #25 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,239
Thanks: 3
Salathe is on a distinguished road
Default

How about pushing this up to a (svn,cvs,git) repository so we can send in patches for changes/improvements?
__________________
salathe@php.net
Salathe is offline  
Reply With Quote
Old 12-27-2008, 06:00 AM   #26 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 836
Thanks: 31
sketchMedia is on a distinguished road
Default

added v1.2 to the TalkPHP google code repo:

http://code.google.com/p/talkphp/source/browse/
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
Old 01-08-2009, 01:32 AM   #27 (permalink)
The Visitor
 
Join Date: Jan 2009
Posts: 1
Thanks: 0
willpower is on a distinguished road
Default

Ok I m a newbee to this php thing.
Can someone tell me more clearly how do I set this up?
I have this placed on my html page.
<img src="<?php echo $pAvatar->getAvatar(); ?>" alt="Gravatar" />
Do I have to link it to this code somehow? How do I do that?
$pAvatar = new TalkPHP_Gravatar();

echo $pAvatar -> setEmail('example@example.com')
-> setSize(80)
-> setRating(GRAVATAR_RATING_PG)
-> getAvatar();
Is the above code supposed to be on a seperate php document within my site and what is that document supposed to be called?
willpower is offline  
Reply With Quote
Old 01-08-2009, 01:36 AM   #28 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,215
Thanks: 90
Wildhoney is on a distinguished road
Default

Very nice, sketchMedia!

You need to place the code in a file that ends in the extension .php to begin with. After that, include the main file like so:

php Code:
include_once('./TalkPHP_Gravatar.php');

Then set the details for the avatar you wish to bring back using the following code:

php Code:
$pAvatar = new TalkPHP_Gravatar();
$pAvatar->setEmail('adam@talkphp.com')->setSize(80);

Where the email address (adam@talkphp.com) is the email address of the user corresponding to their Gravatar account, and size is the pixels square. Finally, still in a file ending in .php add an image to the page which will use the information set above to display the correct image:

php Code:
<img src="<?php echo $pAvatar->getAvatar(); ?>" />

I hope this helps you. If not, please do keep asking questions!
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Reply


LinkBacks (?)
LinkBack to this Thread: http://www.talkphp.com/script-giveaway/1905-gravatar-wrapper-class.html
Posted By For Type Date
Automattic Acquired Gravatar — WP Assist This thread Refback 01-13-2008 09:01 PM
Gravatar 3.0, Powered by Automattic | SYP This thread Refback 01-13-2008 04:14 AM
ShadowReality This thread Refback 01-10-2008 02:06 PM
GRavatar plugin for WordPress and WordPress-MU | Ring Of Blogs This thread Refback 01-09-2008 09:31 PM
Automattic Acquires Gravatar | CenterNetworks - Web 2.0 News, Opinions and Insights from New York This thread Refback 01-09-2008 08:00 PM
Gravatar: Globally Recognized Avatars » Webmaster-Source This thread Refback 01-09-2008 02:43 PM
Support WordPress by Displaying Gravatars On Your Blog This thread Refback 01-09-2008 12:35 PM
Now Gravatar Powered. | Act of War: Warfare Re-defined This thread Refback 01-09-2008 06:08 AM
» This Site Now Gravatar-Enabled! » DragonFlyEye.Net This thread Refback 01-09-2008 06:05 AM
MyChores Journal » Blog Archive » User icons provided by Gravatar This thread Refback 01-09-2008 05:22 AM
Do you have your gravatar yet ? This thread Refback 01-09-2008 04:12 AM
Automattic Gets Gravatar - and Valuation « Changing Way This thread Refback 01-09-2008 03:31 AM
Automattic Acquired Gravatar — WP Assist This thread Refback 01-09-2008 03:12 AM

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 01:46 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design