Avatar Module
Posted by Chris Eaton
All files from this thread
Avatar Module July 28, 2004 09:06PM |
Moderator Registered: 19 years ago Posts: 634 |
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.
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.
Re: Avatar Module July 29, 2004 02:58PM |
Registered: 19 years ago Posts: 683 |
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
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
Disable display checkbox July 29, 2004 04:23PM |
Registered: 19 years ago Posts: 683 |
Re: Disable display checkbox July 29, 2004 05:14PM |
Moderator Registered: 19 years ago Posts: 634 |
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.
-------------------------------------------------------
> 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 |
Registered: 19 years ago Posts: 55 |
Re: Avatar Module July 29, 2004 08:42PM |
Moderator Registered: 19 years ago Posts: 634 |
Re: Avatar Module July 30, 2004 11:13AM |
Registered: 18 years ago Posts: 8 |
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
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 |
Moderator Registered: 19 years ago Posts: 634 |
Re: Avatar Module July 30, 2004 11:22AM |
Registered: 18 years ago Posts: 8 |
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
-------------------------------------------------------
> 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 |
Registered: 19 years ago Posts: 55 |
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 =]
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.