Forums

[resolved] [Plugin: Add Local Avatar] Plugin is only working with lowercase 'jpg' files (4 posts)

  1. sergioalvarado
    Member
    Posted 7 months ago #

    I have installed the 6.6 version of the plugin and it is cropping the user uploaded image fine as long as the file extension is in lowercase.

    for example if a use uploads the image file: "image.jpg" and the resize option is "on" the image uploads and creates the "image-avatar.jpg" file and it can be displayed on the page.

    However if the person uploads the file: "image.JPG" and the resize option is "on" the image uploads and creates the "image-avatar.jpg" but when you look at the current user avatar it iappears to be broken (when inspected it is looking for "image.jpg.JPG")

    I tried removing the:

    . '.' . $parts['extension'];

    in

    $file = basename($resized_file, '.' . $parts['extension']) . '.' . $parts['extension'];

    Once I did this I was able to upload the uppercase "image.JPG" and it worked fine, but when I uploaded a lowercase "image.jpg" itreturned broken and when I inspected it removed the file extension altogether "image"

    Any ideas? already tried adding the MIME TYPE - no success.

    http://wordpress.org/extend/plugins/add-local-avatar/

  2. peterwsterling
    Member
    Posted 7 months ago #

    Thanks for pointing out the problem Sergio!
    Hacking away the extension was never gonna work though... ;-)

    I have now released version 6.7 with a fix.

    Again - thanks,
    Pete.

  3. sergioalvarado
    Member
    Posted 7 months ago #

    Works great. Thanks for your quick response. I'm setting this to resolved.

    By the way I'm using the"customize your community" and the "Members Only" plug-ins. I was getting a small error when people uploaded their avatar the "customized" profile page was not showing the new avatar (or the option to delete it) so here is what I did - let me know if what I did is ok:

    Replaced:

    <?php
    // Display the profile's avatar.
    echo get_avatar($profileuser->ID, 50);
    ?>

    with:

    <?php
    global $current_user;
    get_currentuserinfo();
    $myuser = $current_user -> ID;
    echo get_avatar($myuser,50);
    ?>

    and replaced:

    if(empty($profileuser->avatar)) {

    with

    if(empty($current_user->avatar)) {

    It worked for me, ut let me know if there was an easier way to do this.

    Thanks again for the update.

    Cheers!

  4. peterwsterling
    Member
    Posted 7 months ago #

    Glad it worked for you.

    As to your other issue, it may be working for the logged in users, but I don't think it will work for an administrator maintaining a user's profile for them; I suspect the admin will see their own avatar, and not the [profile]user's avatar. I have not tested this ... so I will look in to it some more next week, it's the Easter break now! ;-)

Reply

You must log in to post.

About this Topic