Firefox PHP

Avatar Module

Posted by Chris Eaton 
All files from this thread

File Name File Size   Posted by Date  
cc_mod_avatar_ger.zip 994 bytes open | download Backbone 08/21/2004 Read message
avatar-patch.php 117 bytes open | download Steve H 08/31/2004 Read message
read.tpl 7 KB open | download Nix Marl 10/16/2004 Read message
read_threads.tpl 6.9 KB open | download Nix Marl 10/16/2004 Read message
files.zip 6.7 KB open | download foster 10/27/2004 Read message
screen.gif 47.4 KB open | download Stoltze 01/31/2005 Read message
posting_messageform.tpl 19.4 KB open | download Sergej 10/26/2005 Read message
avatar.tar.gz 6.9 KB open | download Maurice Makaay 11/07/2005 Read message
phorum_avatar_light_v1.0.zip 10.2 KB open | download Philos 05/22/2006 Read message
read.tpl 3.8 KB open | download Philos 05/22/2006 Read message
avatar.zip 9.7 KB open | download Sergej 12/18/2006 Read message
avatarphp4preview.tar.gz 10 KB open | download orinoco 02/17/2007 Read message
german.php 1.8 KB open | download orinoco 02/18/2007 Read message
french.php 1.8 KB open | download manuvb 02/25/2007 Read message
avatar.zip 10.7 KB open | download __Serg__ 05/08/2007 Read message
Avatar Module
July 28, 2004 09:06PM
Not to be outdone by the poll module posted yesterday, here is the first release of mod_avatar. I'm calling this 1.0 even though there are some things I would like to add. We'll call that one 2.0. :)

You need to make template changes in order to make this module work, I have included some suggestions in readme.txt which is included in the download.

If you want to see it in action, visit my test forum at [www.hiredgoons.ca] . Note that this phorum gets wiped out periodically. (the poll module is also enabled there)

What this does:
----------------
- Users upload avatars using Phorum's file upload facility (so they can have multiple avatars)

- Users can select a "default" avatar that is automatically selected when posting, as well as block avatars entirely

- Users and Moderators can change the selected avatar when editing a post

- Admin can set the maximum height/width of an avatar (unfortunately this is also the minimum at the moment)

- Admins can also select what types of images are valid for avatars, seperately from which types of files may be uploaded.


What this doesn't do:
---------------------

- Image processing of any kind. The height/width restrictions are enforced in the IMG tag, and no images are ever resized. I would like to improve this, but I'm not sure how. The best I can come up with is to allow a user to pick which images will be usable as avatars (as opposed to all of them which is how it works now), and resize those using pat's method from his Pic in Profile hack. (see [phorum.org] )

Pat, if you would like to help me out in this area, I would greatly appreciate it.

- Store the images in any way other then in Phorum's database. Writing a seperate image storage method is a real pain when Phorum's system does the job already. Besides, any improvements to Phorum's system will automatically be used by the module, which is not true if I wrote my own.

- Making sure that people don't post R rated avatars. You have to do that yourself if you want to keep those types of things off your site. :)


This one was a fair bit of work for me, and is still a work in progress. So comments are greatly appreciated.

Download: [www.hiredgoons.ca]


ps: portal of curiousity - before you ask me, yes I can make a new version of the Named Posting module that will support dual default avatars (in the same way it supports dual sigs/posting names). However, at the moment you can't specify the order modules run in Phorum, and this is a problem. Named Posting will have to go *LAST*, and you can't easily force that right now.

So first I will have to look at how to get it to run last, then I will add the functionality. In the mean time, users can pick the correct avatar when posting.
pat
Re: Avatar Module
July 29, 2004 02:58PM
Hi Chris,

I feel very honored, that you ask me to help you. I've already asked my wife to smack me and it still hurts - so this is really no dream ! ;-)
I doubt that I could be really of much help, as you are much more advanced than I am, nevertheless I am willing to do what I can...

Basicly you could just take my picProcessor.php (see source-code for details) and throw all the pics at it, as I do. But then you'd have to live with an extra cache folder (cached pics not stored in the db). And a Problem that I haven't dealt with by now is the deletion of the cached file once the user changes the avatar/pic.

Alternatively we could stick our heads/code together to create a purely pic-proccessing module, that could be used as versatile as file.php for example.

Feel free to use my stuff and tell me if you need further help or involvement...

pat

pat
Disable display checkbox
July 29, 2004 04:23PM
Hi chris,

what is the "Disable display of Avatars"-checkbox for is'nt that redundand, you could just use the option <no avartar> in the dropdown, could'nt you?

pat
Re: Disable display checkbox
July 29, 2004 05:14PM
pat Wrote:
-------------------------------------------------------
> Hi chris,
>
> what is the "Disable display of Avatars"-checkbox
> for is'nt that redundand, you could just use the
> option <no avartar> in the dropdown,
> could'nt you?

No, they don't do the same thing. "No Avatar" means that the particular post being made will not have an avatar.

"Disable display of Avatars" blocks *ALL* avatars on all posts from all users. If a user turns that on, they will never see an avatar (but they can still make posts that have an avatar attached).

Its meant for people on dialup, and people who consider avatars "useless clutter" on the page. Really thats an optional thing, you don't have to put it into the template at all. But I'm fairly confident it'll reduce the number of people griping about avatars that you have to listen to. :)

pat Wrote:
-------------------------------------------------------
> Hi Chris,
>
> I feel very honored, that you ask me to help you.
> I've already asked my wife to smack me and it
> still hurts - so this is really no dream ! ;-)
> I doubt that I could be really of much help, as
> you are much more advanced than I am, nevertheless
> I am willing to do what I can...

Wow. Either you give me too much credit, or yourself not enough. The image processing is the harder of the tasks here. :)

> Basicly you could just take my picProcessor.php
> (see source-code for details) and throw all the
> pics at it, as I do. But then you'd have to live
> with an extra cache folder (cached pics not stored
> in the db). And a Problem that I haven't dealt
> with by now is the deletion of the cached file
> once the user changes the avatar/pic.
>
> Alternatively we could stick our heads/code
> together to create a purely pic-proccessing
> module, that could be used as versatile as
> file.php for example.

This is what I'm thinking. The Avatar module is capable of acting as an interface for getting images to/from the database, but it doesn't know anything about image processing.

What I'm thinking is that a user can upload a file, and then say "I want to use this file as an avatar". mod_avatar would then send the image through the Pic Processor to resize it properly, save the new image back to the database, and then add that avatar to the list of ones the user can select.

The Pic Processor can be turned into a function that takes a file ID for an image (as well as the maximum dimensions we want to allow), resizes it, saves it back to the database, and then returns if the resize was successful or not. There are functions included in Phorum already for getting and storing files in the database, so we can use those.

What do you think of that?

> Feel free to use my stuff and tell me if you need
> further help or involvement...

Cool, thanks.
Re: Avatar Module
July 29, 2004 06:46PM
I have some experience doing image manipulation in php - would you like some help allowing for image resizing? I can take a look at it for you if you'd like.

I'm sure I can at least resize the image..
Re: Avatar Module
July 29, 2004 08:42PM
Sure, anybody is welcome to play around with it if they want.
Re: Avatar Module
July 30, 2004 11:13AM
Hi Chris,

I've installed this on my board, and made all of the template suggestions you suggest in the readme.txt file, and I have made the extra field name in admin that you have suggested.

But in Control Panel, it still gives <None> as the only option, even though I have uploaded a file.

Am I missing something?

Chris

Re: Avatar Module
July 30, 2004 11:18AM
What is the file extension on the file? Did you configure the module settings to allow that type of file to be used as an avatar?
Re: Avatar Module
July 30, 2004 11:22AM
Tridus Wrote:
-------------------------------------------------------
> What is the file extension on the file? Did you
> configure the module settings to allow that type
> of file to be used as an avatar?


Found out I forgot to turn on the Module. When looking at your Posting for Polling, I figured that out.

Perhaps Phorum, should have some way of knowing if a module is on or not, and be able to not display information regarding modules to end users if its off.

Chris
Re: Avatar Module
July 30, 2004 02:07PM
In referance to making sure the images are the proper size, I think we'd be using [www.php.net].

The only problem is that I'd like to do that when the user is uploading an avatar - and there is no hook after files are uploaded.

any ideas? I don't want to make this into a hack =]
Sorry, only registered users may post in this forum.

Click here to login