1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Imagick avatar error: Please enter a positive whole number

Discussion in 'Resolved Bug Reports' started by TazDevilLooney, Jul 16, 2011.

  1. TazDevilLooney

    TazDevilLooney Active Member

    Xenforo 1.0.4

    ImageMagick PECL Extension

    I get this error when i try uploading SOME animated gif's

    SnapShot_070521.png
    The gif im trying to upload is 388KB 500x500

    Animated-GIFs-davidope-20.gif

    A zipped version is included below.

    If i use the refresh button everything works correctly and the avatar has uploaded and is animating.

    I get this error report in xenforo.

    Code:
    ErrorException: rename(\mysite.com\_\internal_data\temp\xfA90.tmp,C:\mysite.com\_/data/avatars/s/0/7.jpg) [<a href='function.rename'>function.rename</a>]: Access is denied. (code: 5) - library\XenForo\Model\Avatar.php:337
    Generated By: Makcalable, 43 minutes ago
    Stack Trace
    #0 [internal function]: XenForo_Application::handlePhpError(2, 'rename(\v...', '\_...', 337, Array)
    #1 \mysite.com\_\library\XenForo\Model\Avatar.php(337): rename(\vhosts\_...', '\vhosts\_...')
    #2 \mysite.com\_\library\XenForo\Model\Avatar.php(201): XenForo_Model_Avatar->_writeAvatar(7, 's', \vhosts\_...')
    #3 \mysite.com\_\library\XenForo\Model\Avatar.php(69): XenForo_Model_Avatar->applyAvatar(7, 'C:\Windows\Temp...', 1, 500, 500, Array)
    #4 \mysite.com\_\library\XenForo\ControllerPublic\Account.php(489): XenForo_Model_Avatar->uploadAvatar(Object(XenForo_Upload), 7, Array)
    #5 \mysite.com\_\library\XenForo\FrontController.php(310): XenForo_ControllerPublic_Account->actionAvatarUpload()
    #6 \mysite.com\_\library\XenForo\FrontController.php(132): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
    #7 \mysite.com\_\index.php(13): XenForo_FrontController->run()
    #8 {main}
    Request State
    array(3) {
      ["url"] => string(44) "http://mysite.com/account/avatar-upload"
      ["_GET"] => array(0) {
      }
      ["_POST"] => array(8) {
        ["use_gravatar"] => string(1) "0"
        ["avatar_date"] => string(10) "1310836657"
        ["avatar_crop_x"] => string(1) "0"
        ["avatar_crop_y"] => string(1) "0"
        ["_xfToken"] => string(53) "7,1310848176,58116d120fa225c1583af5248a3d6132414869da"
        ["_xfNoRedirect"] => string(1) "1"
        ["_xfResponseType"] => string(9) "json-text"
        ["_xfUploader"] => string(1) "1"
      }
    }
    My server logs only contain 200 / 304 or this one line.

    Code:
    [Sat Jul 16 22:00:28 2011] [error] [client 189.221.150.65] ModSecurity: Multipart parser init failed: Multipart: Multiple boundary parameters in C-T. [hostname "fixitwizkid.com"] [uri "/account/avatar-upload"] [unique_id "TiH77MCoAUcAABO4HY8AAAAW"]
    Untitled-200000.png

    Any idears?
     

    Attached Files:

  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    This looks like a problem of file permissions when XenForo tries to move the file into place ("Access is denied"). Make sure both data and internal_data (and all of their subdirectories) are writable by the web server.
     
    TazDevilLooney likes this.
  3. TazDevilLooney

    TazDevilLooney Active Member

    Thanks for the reply Jake, this only happens on some animated gif's. Some will upload fine others don't. I can't see this being a server issue or none of them would of uploaded. ;)

    Seems to give an error on the renaming of the uploaded avatar from .tmp to what ever extension. Well that's my thought.

    That's a point why is it renaming a .gif to a .jpg?

    Be nice to know if anyone else gets this error with the avatar provided. :whistle:
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The error is pretty clear. If it only happens with some images then maybe your file permissions are inconsistent within data and internal_data. Try setting the permissions to propagate down to all subdirectories. Maybe different images are processed differently such that not all images produce an error. Just guessing.
     
  5. TazDevilLooney

    TazDevilLooney Active Member

    I can understand what your saying Jake however i have had no problems with the prevoius versions of the xenforo build. None of the premissions have been changed on the server since the beta days of xenforo.
     
  6. lasertits

    lasertits Active Member

    Sorry to bump an old thread, but I'm having this issue as well. Like Taz, it only occurs with some animated gif files. It's not the permissions, everything in there is all set. No idea what the issue could be...

    Kind of curious if Taz or anyone else ended up figuring this out or going back to the default php gd one.
     
  7. TazDevilLooney

    TazDevilLooney Active Member

    My problem it still unresloved. Only does it with large gif's don't know why. Sorry i can't be more helpfull :(
     
  8. Digital Doctor

    Digital Doctor Well-Known Member

    Would it be smart to collect the problematic animated .gifs to try to see if there is a pattern ?
     
  9. Machiavelli

    Machiavelli Member

    i am having exactly the same problem, trying to upload a static JPG image, ~20KB, 367 x 367 pixels. i have changed my avatar several times, and this is the first time i have ever seen this message.

    permissions are definitely correct (filezilla reports the above named folders as drwxrwxrwx), and i'm using xenforo 1.1.3.
     
  10. Machiavelli

    Machiavelli Member

    hmm - i've just changed my avatar to something else, so it seems it's just a problem with the image! i'll attach it here for reference:

    bender_monocle_367x367.jpg
     
  11. Edrondol

    Edrondol Well-Known Member

    I just downloaded and loaded this on my test board with no issues.
     
  12. DarkUnderlord

    DarkUnderlord Member

    Yeah ok, I got this too. I've been modifying user's avatars through the admin panel. Everything was fine except for one user where I kept getting:

    Error
    Please enter a positive whole number.​

    I tried a different image and that worked fine. I then tried the "faulty avatar image" with a different user and had the same problem.

    So I opened the file in Paint Shop Pro, copied it, named it something else, saved it as a new image, tried again and it worked fine. Odd though.
     
  13. DarkUnderlord

    DarkUnderlord Member

    Update: So here's more weirdness, if I try to change my avatar to one of those failed "please enter a positive number" images that bugs out XenForo, it fails but... My while "large-sized" avatar will still show as the previous avatar, everywhere it uses the small and medium sizes will end up being the "failed" image.

    Must be a bug or something in how XenForo is re-sizing / copying / moving images.

    See the image and how my large avatar is one image while my small avatar is another (the one that "isn't positive")...

    wtfxenforo.png
     
  14. Digital Doctor

    Digital Doctor Well-Known Member

    @DarkUnderlord

    Same issue .... might be admin panel specific ? (no idea).

    Search I used.
     
  15. DarkUnderlord

    DarkUnderlord Member

    Yeah, seems something to do with particular images. Maybe their dimensions or something - because re-sizing or even re-saving the image in a different format (jpg > png, png > jpg) seems to make it work fine.
     
  16. DarkUnderlord

    DarkUnderlord Member

    UPDATE: Fixing or re-doing transparency and upscaling the avatars to at least 96px wide seems to rectify the situation with b0rked avatars.
     
  17. Mike

    Mike XenForo Developer Staff Member

    I just managed to reproduce this. Strangely, Imagemagick was converting a 367x367 file to... 191x192?! Some weird rounding error it seems. However, there is a "fill" option that appears to be able to fix this, so I've changed that for 1.2.3. (GD doesn't seem to have this problem.)
     
  18. DarkUnderlord

    DarkUnderlord Member

    Ahhh... Nice, thanks!
     
  19. Digital Doctor

    Digital Doctor Well-Known Member

    @Brogan
    Move to Bugs + add [Fixed] ?
    Add Image Imagemagick to title ?
     

Share This Page