NYCPHP Meetup

NYPHP.org

[nycphp-talk] Creating Avatar Images

Ben Sgro (ProjectSkyLine) ben at projectskyline.com
Fri Oct 12 19:17:35 EDT 2007


Hello Again,

No, I don't want to roll my own at all. I want the quickest way possible
to do this.

The code I have *should* work, but doesn't....

            $imageObject =& Image_Transform::factory('');
            $imageObject->load($fileName);
            if ( PEAR::isError($imageObject) )
            {
                error_log("imageObject->load( ) error");
            }
            $imageObject->fit(90, 110);
            if ( PEAR::isError($imageObject) )
            {
                error_log("imageObject->fit( ) error");
            }
            $newFileName  = substr($fileName, 0, strrpos($fileName,"."));
            $newFileName .= '.png';
            $imageObject->save(USER_IMAGES_PATH . $newFileName);
            if ( PEAR::isError($imageObject) )
            {
                error_log("imageObject->save( ) error");
            }
            print_r($imageObject);

I can't figure it out. No PEAR errors are getting thrown,
but the image is never being saved.

Any ideas? The file is getting uploaded to the server, I can see that.

Thanks!

- Ben

Ben Sgro, President
ProjectSkyLine - Defining New Horizons
+1 718.487.9368 (N.Y. Office)

Our company: www.projectskyline.com
Our products: www.project-contact.com

This e-mail is confidential information intended only for the use of the 
individual to whom it is addressed.
----- Original Message ----- 
From: "Jon Baer" <jonbaer at jonbaer.com>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Sent: Friday, October 12, 2007 12:24 PM
Subject: Re: [nycphp-talk] Creating Avatar Images


Well I was not suggesting to fully use the gravatar site itself
(although you can scale to whatever size you wish for your avatar
using &size=n), I think they recognize anything > 80px to not be an
"avatar" ... your question dealt w/ the security of such images + the
technique w/ the MD5 hash of email address link to an image path was
more the idea.

There actually is an excellent library if you want to roll your
own ... http://phpthumb.sourceforge.net.  It includes this hashing
mechanism already.

- Jon

On Oct 11, 2007, at 10:18 PM, Ben Sgro ((ProjectSkyLine)) wrote:

> Hello Jon,
>
> A gravatar, or globally recognized avatar, is quite simply an 80×80  pixel 
> avatar image that follows you from weblog to weblog appearing  beside your 
> name when you comment on gravatar enabled sites.  Avatars help identify 
> your posts on web forums, so why not on weblogs?
>
> Not exactly what Im looking for. In fact, this has external  dependencies 
> on the gravatar.com site.
>
> Thanks anyways.
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php 




More information about the talk mailing list