avatar – current, upload, crop

followed the install instructions, when i go under the avatar section i don’t see a default avatar. when i go to add one, i get the below error:

Warning: getimagesize(http://domain.com/user/avatar/avatar_adam.gif) [function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 in /homepages/38/d218960724/htdocs/wp-content/mu-plugins/avatar.php on line 244

when i try to crop the uploaded image, the box to crop doesn’t cooperate.

  • Andrew
    • Champion of Loops

    Hello,

    I’ll need to know a bit about your server environment. However, I think this may be similar (if not identical) to the other reported problem. Basically the avatar plugin works on 99% of the sites but we can’t figure out why it doesn’t work on the 1%.

    Thanks,

    Andrew

  • tricky
    • WPMU DEV Initiate

    I’m running into the same problem. This is what i get when i try to upload an avatar:

    Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in /home/.aristotle/purb/plataformaciudadana.cl/wp-content/mu-plugins/avatar.php on line 244

    Warning: getimagesize(http://plataformaciudadana.cl/avatar/15-09-07_2051.jpg) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in /home/.aristotle/purb/plataformaciudadana.cl/wp-content/mu-plugins/avatar.php on line 244

  • Luke
    • The Crimson Coder

    Things to look for:

    Permissions, permissions, and permissions.

    Make sure the script has permission on /avatar/. It needs to be able to write to that directory.

    For your environment, it could be anything from 700 to 777, depending on how you’re set-up.

    If you’re on shared hosting, you may have to consult with your host on proper permission settings for this.

    As a note, if uploads through the new post page are working, cross check your permissions (and potentially ownership) of your wp-content/blogs.dir for reference.

    If everything looks OK, another clue in that message is this:

    “URL file-access is disabled in the server configuration in”

    Sounds like a host issue. I’d have to dig through the code, but I can’t recall that it grabs the image through http. I’m pretty sure all the paths that are set are absolute.

    It “may” check to see if it exists through http, but I can’t say for sure.

    “HTTP request failed! HTTP/1.1 404”

    404 = Not Found

    Is the file there?

  • tricky
    • WPMU DEV Initiate

    Luke,

    As you can see, the plugin relays on htaccess for /avatar:

    RewriteRule ^(.*/)?avatar/(.*) wp-content/avatars.php?file=$2 [L]

    Files do get uploaded to wp-content/blogs.dir/blog_id/avatar/file.jpg since the script creates those folders and places the file, i don’t think it’s a permissions issue.

    it seems it uses a http get file method to process the image file for cropping/resizing, which causes it to fail on this (shared) hosting: “URL file-access is disabled in the server”

  • Luke
    • The Crimson Coder

    Hmmm… I’ll have to look at a completely clean version of this. Since I already had avatars in place with my own custom code, I had to modify it a bit. Wouldn’t want individual users not having an avatar anymore, plus I wanted the crop stuff. :slight_smile:

    That “would” make sense though, if it tries to grab it by the url. Although, it “should” be able to know what the full path to the avatar is, so it “should” be able to use absolute paths vice a url.

  • systemaddict
    • WPMU DEV Initiate

    Your htaccess should look something similar to this:

    RewriteEngine On

    RewriteBase /

    #uploaded files

    RewriteRule ^(.*/)?files/$ index.php [L]

    RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

    RewriteRule ^(.*/)?avatar/(.*) wp-content/avatars.php?file=$2 [L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]

    RewriteCond %{REQUEST_FILENAME} -d

    RewriteRule . – [L]

    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]

    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]

    RewriteRule . index.php [L]

  • tricky
    • WPMU DEV Initiate

    systemaddict, thanks for you tip, it works now!!

    perhaps andrew could add this to install.txt

    the thing is, it stills shows the same error:

    Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in /home/.aristotle/purb/plataformaciudadana.cl/wp-content/mu-plugins/avatar.php on line 244

    Warning: getimagesize(http://plataformaciudadana.cl/avatar/15-09-07_2051.jpg) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in /home/.aristotle/purb/plataformaciudadana.cl/wp-content/mu-plugins/avatar.php on line 244

    how can i make this error dissapear?

  • bschwarting
    • Flash Drive

    i think this comment might have gotten overlooked. can someone else respond?

    you said, “Make sure the script has permission on /avatar/.”

    do you mean the avatars.php and avatar.php files or another directory? if so, what path?

    am i missing something? i never saw anything in the install doc that said to create an avatar folder.

  • tricky
    • WPMU DEV Initiate

    bschwarting, nevermind about the avatar folder, that’s not the issue.

    line 244:

    list($tmp_avatar_width, $tmp_avatar_height, $tmp_avatar_type, $tmp_avatar_attr) = getimagesize(get_option('siteurl') . "/avatar/" . basename( $_FILES['avatarfile']['name']));

    It looks like its trying to get some file info trough the server in order to distinguish between jpg, gif, png. the weird thing is that line 245-255 are commented, and then repeated.

  • Luke
    • The Crimson Coder

    You’re right tricky.

    I was looking at my own install, which indeed is hack all to pieces to mix in some of the things Andrew was doing in the back with this, and still keep my (then current) system intact.

    get_option('siteurl') is the problem, obviously. Your host won’t allow files to be called by a url like that.

    Instead, it should be called by the absolute path to that file.

    Which would be: ABSPATH . 'wp-content/blogs.dir/' . $blog_id . '/avatar/' . basename($_FILES['avatarfile']['name'])

    Not that I support changing it to that, but you get the idea. A lot of shared hosts won’t allow such things to be grabbed with a url, they want to see an absolute path.

    So, at least it’s narrowed down to “what” it is. If you have the skills to turn those calls to the url path into an absolute path, go for it. :wink:

    If you’re a little unsure, you could ask your host to allow that to be overridden in your htaccess file, turn it on to allow it, or hang back a bit until Andrew can whip up some of that magic he has and put an update out for it. :slight_smile:

  • bschwarting
    • Flash Drive

    weird, new, good twist. i’ve been doing all my testing under the admin account, which still doesn’t work. when i test the avatar with another user, it works fine, which i thought i tested that before for sure. crazy, weird, but it works now. man, that is a sweet plugin! any random thoughts as to why the admin account doesn’t work? maybe it was in documentation and i missed it?

  • vishywashi
    • New Recruit

    I have installed the plugin to as per the instruction.. i have crossed checked it files

    avatars.php – are placed in /wp-content/mu-plugins

    widget-avatar.php – are placed in /wp-content/mu-plugins

    avatar-comments.php – are placed in /wp-content/mu-plugins

    avatar-posts.php – are placed in /wp-content/mu-plugins

    avatar.php – are placed in /wp-content

    mystery-128.png – are placed in /wp-content

    mystery-96.png – are placed in /wp-content

    mystery-48.png – are placed in /wp-content

    mystery-32.png – are placed in /wp-content

    mystery-16.png – are placed in /wp-content

    options-discussion.php – has been overwritten /wp-admin – overwrite existing file

    I have also added the following line to .htaccess under the line that handles uploaded files:

    RewriteRule ^(.*/)?avatar/(.*) wp-content/avatar.php?file=$2 [L]

    i have also created the following directories:

    /wp-content/avatars/user

    /wp-content/avatars/blog

    But still the avatars are not showing on the blog and comments

    Is there any thing i am missing ?? Please let me know about it

    Thank You Sumesh

  • ryo128
    • New Recruit

    Here is the errors i got :

    Warning: mkdir(/home/ericodom/public_html/wp-content/avatars/user/c81/) [function.mkdir]: Permission denied in /home/ericodom/public_html/wp-content/mu-plugins/avatars.php on line 653

    Warning: move_uploaded_file(/home/ericodom/public_html/wp-content/avatars/user/c81/naruto-avatar-007.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/ericodom/public_html/wp-content/mu-plugins/avatars.php on line 658

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘/tmp/phpJ6K7bi’ to ‘/home/ericodom/public_html/wp-content/avatars/user/c81/naruto-avatar-007.jpg’ in /home/ericodom/public_html/wp-content/mu-plugins/avatars.php on line 658

    There was an error uploading the file, please try again.

    Warning: getimagesize(/home/ericodom/public_html/wp-content/avatars/user/c81/naruto-avatar-007.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /home/ericodom/public_html/wp-content/mu-plugins/avatars.php on line 664

  • ryo128
    • New Recruit

    Hi,

    I have change the permission for the directories to 775 and it still does not work.

    I am really at my wits end and i am no good in php.

    Is there any person i can hire to do the job for me? I also need some customization on the frontpage.

    Thanks!

  • Andrew
    • Champion of Loops

    Typically I’d take a look at your install at this point but this plugin works just fine if installed correctly and the instructions are actually pretty clear. All you do is create the directories, upload the files, and add the line to your .htaccess file.

    Thanks,

    Andrew

  • svsanchez
    • New Recruit

    Hello, I have installed the avatars plugin and it is working, however when I click the “ALTERNATIVE UPLOAD” button I get the following error messages:

    There was an error uploading the file, please try again.

    Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/miarticu/public_html/wp-content/mu-plugins/avatars.php on line 699

    Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/miarticu/public_html/wp-content/mu-plugins/avatars.php on line 707

    Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/miarticu/public_html/wp-content/mu-plugins/avatars.php on line 715

    Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/miarticu/public_html/wp-content/mu-plugins/avatars.php on line 723

    Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/miarticu/public_html/wp-content/mu-plugins/avatars.php on line 731

    Warning: unlink(/home/miarticu/public_html/wp-content/avatars/user/c4c/)[funcion.unlink]: Is a directory in /home/miarticu/public_html/wp-content/mu-plugins/avatars.php on line 890

    Please help!

    Thx…