bbPress

Simple, Fast, Elegant

bbPress plugin browser »

Avatar Upload (0.8.3)

Download

Version: 0.8.3

Other Versions

Last Updated: 2007-9-9

Requires bbPress Version: 0.8.2 or higher

Compatible up to: 0.8.2.1

Author Homepage »

Plugin Homepage »

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(12)

Your Rating

Author: Louise Dade


  1. Next version I will hopefully have some code for you to grab any existing gravatar for the user's email address and offer it to them as a possibility for local storage...

    ooh you added resizing with ratio... I'll have to take a peek at what you did...

    Posted: 1 year ago #
  2. Lovely Louisedade. :) Are you intentionally loading identicon.php every time? Thinking about it, I think the best solution would be to take out all the plugin info and the underscore (so that bb never loads it, it won't be activated etc.) and only include_once() it inside felapplyidenticon(), just before the 'if( class_exists("identicon"))` check. That way all that code is only loaded in that vast minority of cases when it's actually useful.

    A class applied to the <img /> HTML generated by avatarupload_display would be useful, to be able to style them. :)

    But it's great that identicons are included at all, and the other features you added are also cool. ^^ Sorry that the two of us are constantly harassing you to make changes. :P

    Posted: 1 year ago #
  3. nlaspf

    Inactive

    I'd suggest setting it to use the default avatar by default instead of the Identicons. I forgot to change it before I installed the plugin and now all the existing users have an identicon. If it was the other way round, that is, the default avatar was set by default and I wanted identicons, and I forgot to change it, I wouldn't end up with images I don't want.

    Is there any way to reset all the avatars at once? I don't want to have to reset them one by one.

    Posted: 1 year ago #
  4. Oh *rude word* that's entirely my fault - so sorry nlaspf! The generic default avatar is supposed to be the default option. I was lazy and uploaded the trunk code directly to my test server instead of saving a copy to upload and forgot to change the setting back to before committing to the plugin repositry.

    There isn't an inbuilt way to change all your users avatars at once, but if you have some sort of access to the MySQL database (e.g. phpMyAdmin), then you can just delete all entries in the usermeta table for meta_key='avatar_file'. If some users have already uploaded their own avatar, then you'll also need to filter those out. Something like this will work:

    DELETE FROM bb_usermeta WHERE meta_key = 'avatar_file' AND meta_value LIKE '%identicon%'

    Hmm, I don't really want to load the Identicon class everytime - I wondered how to stop that. So it's as simple as removing the Plugin header! Good.

    Posted: 1 year ago #
  5. Version 6.0.1 has fixed the default avatar setting and stopped the identicon code loading unnecessarily. I've also introduced a config setting to set the size of the Indenticons.

    Posted: 1 year ago #
  6. When editing the 'post' template to include the image, try this instead of '<?php avatarupload_display(get_post_author_id()); ?>':

    <a href='<?php echo apply_filters( 'user_profile_link', get_user_profile_link(get_post_author_id()) ) . "'>"; avatarupload_display(get_post_author_id()); ?></a>

    This will make the user icon link to the user's profile. It's a nice big colorful target that attracts the mouse, may as well use it!

    Posted: 1 year ago #
  7. I finally had some time to install 0.6.1 and wanted to say thanks, you did a fantastic job. Thanks for listening to all my ideas.

    There is still some kind of refresh problem, the sleep is not fixing it and now that the timestamp is being appended from the database I realize that the form is still showing the old timedate stamp from the database. So sleep is not the solution. Something is wrong in the way the avatar.php template is being filled before the database is being flushed after write, not reading the newest timestamp for some reason?

    On my personal todo list for this plugin is a sharpen after resize and must more tricky to patch gif files so they don't loop forever or too quickly.

    OOOH! I just had a brainstorm after trying for 30 minutes to figure out why usermeta was not flushing and giving the proper new image on the template.

    There must be a bug when usermeta is told to update that it's written to mysql but not updated in memory. So after update, the template is loaded in the same pass and bbpress is not reloaded so the data is not refreshed. But if you refresh, the metadata is reload into memory.

    I'll have to try to hack up a workaround!

    Posted: 1 year ago #
  8. Ta da! Found the bug.

    Delete the sleep(3) in avatar-upload.php no longer needed.

    The problem is you are trying to be efficient and load the avatar_file from memory instead of a direct mysql call (ie. force db) and after an upload the template is loaded directly in one single pass without reloading bbpress so the database never gets called on again.

    right after (or before) the bb_update_usermeta you need to add this:

    global $user; $user->avatar_file=$meta_avatar;
    bb_update_usermeta( $user_id, 'avatar_file', $meta_avatar );
    $success_message = "Your avatar has been uploaded.";

    and the avatar will always be refreshed after upload.
    No more slow sleep delay! Yay!

    Whew, well now i gotta work to get that hour back...

    Posted: 1 year ago #
  9. EgyptUrnash - excellent tip! I might start collating people's usage and style tips for Avatar Upload and add them as a (fully credited) "Tips'n'Tricks" file in the download.

    _ck_ : Brilliant, and simple! Also, when you explained the problem I looked at my code and stupidly I allowed for the possibility of pulling the avatar directly from the database in the avatarupload_get_avatar() function but forgot to add it to the avatarupload_display() function - I'll try adding that to the code first before adding your solution.

    Regarding image sharpening, I don't think there is any need to reinvent the wheel. This guy has already developed an 'Unsharp Mask' algorithm for PHP: http://vikjavev.no/computing/ump.php

    It's being used in vBulletin and I'm going to fire off an email requesting permission to use it in the Avatar Upload plugin.

    My only concern is whether it's truly worth the extra processing resources. I might make it an option than can be switched off.

    The animated GIF looping issue is more complex - personally I'd be tempted to find a way of banning them altogether, but then I can be a bit of a grouch on such issues.

    Posted: 1 year ago #
  10. Version 0.6.2 uploaded. Now makes use of the $force_db option in the avatarupload_get_avatar() function and it works on my server -- the timestamp is updated in the template after an upload. So, sleep() has gone!

    (PS: I found an English version of the Unsharp Mask for PHP page while looking for an email addres: http://vikjavev.no/computing/ump.php?spr=en )

    Posted: 1 year ago #
  11. Yeah I knew about that routine, was hoping there was a way to do it with less code. Too bad GD library doesn't have it.

    Considering sharpening only has to be done once after an upload and it's not like 100 users do that at once or every day, it shouldn't be an issue.

    I think I can tackle the gif problem. It's just two bytes in a specific position in the file. I just have to figure out how in PHP to search and replace within a binary file. Or maybe since it's a limited size, load it into memory and then write it back out. I want to change unlimited loops to like 9 loops max.

    Posted: 1 year ago #
  12. I've got permission to use the Unsharp Mask routine, so I'll be installing and testing it over the next week.

    Posted: 1 year ago #
  13. Hello^

    i have a problem

    Warning: imagesavealpha(): supplied argument is not a valid Image resource in /usr/local/www/apache22/data/forum/my-plugins/identicon.php on line200

    Warning: imagealphablending(): supplied argument is not a valid Image resource in /usr/local/www/apache22/data/forum/my-plugins/identicon.php on line 201

    Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /usr/local/www/apache22/data/forum/my-plugins/identicon.php on line 202

    Warning: imagepng(): supplied argument is not a valid Image resource in /usr/local/www/apache22/data/forum/my-plugins/bb-avatar-upload.php on line 144`

    Posted: 1 year ago #
  14. Hello^

    i have a problem

    Warning: imagesavealpha(): supplied argument is not a valid Image resource in /usr/local/www/apache22/data/forum/my-plugins/identicon.php on line 200

    Warning: imagealphablending(): supplied argument is not a valid Image resource in /usr/local/www/apache22/data/forum/my-plugins/identicon.php on line 201

    Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /usr/local/www/apache22/data/forum/my-plugins/identicon.php on line 202

    Warning: imagepng(): supplied argument is not a valid Image resource in /usr/local/www/apache22/data/forum/my-plugins/bb-avatar-upload.php on line 144

    Posted: 1 year ago #
  15. Hi ollejah,

    I think the problem could lie in the version of PHP your server uses and the GD library installed. The line of code immediately before the ones reported is an attempt to create a truecolor image, the reuslting errors you see are a result of that code not working:

    $out = @imagecreatetruecolor($outsize,$outsize);

    This function needs PHP version >= 4.0.6 or PHP 5 and GD library GD 2.0.1 or later (see: PHP Manual).

    Could you please let me know what version of PHP and GD library you are using? If you do not know, ask your hosting provider who should inform you.

    Are you able to upload images at all? I mean images that are larger than the maximum dimensions so that they have to be resized?

    If my theory is correct then you should have no trouble uploading a gif file (uses a different function), but the jpegs and png images will fail.

    Posted: 1 year ago #
  16. aldwingalapon

    Inactive

    Plugin could not be activated; it produced a Fatal Error.

    need help. it generated an error when trying to activate the plug in.

    Posted: 1 year ago #
  17. louisedade, be sure to see my patch for a non-caching bug.

    Posted: 1 year ago #
  18. @ aldwingalapon - if you were trying to install my plugin using the Plugin Browser plugin then currently there is a problem with compatibility (see this discussion).

    However a new version coming up in a short while (in fact, but the time you read this it should already be updated!) -- so please try updating the plugin to the latest version 0.7 (again, if you're using the Plugin Browser plugin, you'll need the latest version of that first - although when I tested it there was still a problem).

    In fact, try downloading the plugin directly and installing it manually, just to check - if it still doesn't work for you, then something else is wrong.

    @_ck_ Yes, I've seen it, but too late for this release. Right now, I'm more concerned with getting the plugin working with the Plugin Browser.

    Posted: 1 year ago #
  19. Hi, louisedade,

    result of that code not working:
    $out = @imagecreatetruecolor($outsize,$outsize);

    My server work PHP Version 5.2.0 with GD bundled (2.0.28 compatible)

    Posted: 1 year ago #
  20. ollejah, ok, your version of PHP and GD library should be ok, so I do not know what the problem might be.

    It sounds like somewhere an image is not being created - as I didn't write the Identicon code (which is where the origin of the problem apparantly stems from), then it'll take me a whole to work out the problem.

    Sorry I can't be of more immediate help -- have you tried updating to the very latest version fo the plugin? If it still causes you problems, in the interim I suggest you disable Identicons and just use the default avatar image.

    Posted: 1 year ago #

RSS feed for this topic

Add a Comment »

You must log in to post.

Code is Poetry.