Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

[Solved] thumbnail creation on file uploads fails on some jpg files of a certain size and dimensions

avantime4mikeavantime4mike ✭✭
edited September 2013 in Vanilla 2.0 - 2.8

Since upgrading Vanilla to ver 2.0.18.8 Fileupload (ver 1.5.2) has stopped working correctly. When uploading some files the "uploading" graphic appears for the usual 10 seconds before disappearing but the file is not shown in the post. The test file I used is a 812kb jpeg and if I reduce it's size it will upload correctly. This same file uploaded ok prior to the Vanilla upgrade and all users are affected.

«1

Comments

  • Options

    Should have mentioned PHPinfo shows:-
    post_max_size 8M 8M upload_max_filesize 40M 40M

  • Options

    Added to config at the suggestion of peregrine:-

    $Configuration['Garden']['Upload']['AllowedFileExtensions']= array('txt','jpg','jpeg','gif','png','bmp','tiff','zip','gz','tar.gz','tgz','psd','ai','fla','swf','pdf','doc','xls','ppt','docx','xlsx','log','rar','7z','mp3','wav','aiff','mov');
    $Configuration['Garden']['Upload']['MaxFileSize']= '2M';

    Hasn't resolved the problem though.

  • Options
    hgtonighthgtonight ∞ · New Moderator

    What version were you using before the upgrade?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options
    peregrineperegrine MVP
    edited September 2013

    hgtonight - a version of 2.0.17.x

    my first guess was socket timeout,...

    and then i tried to upload image.

    I tried posting an image the uploading button kept going - bytes were being transmitted.
    then I got a sql error - discussion doesn't exit.

    could there be a timeout on the sql applying discussion?

    then in my browser consolet error log

    500 Internal Server Error
    1.44s
    jquery....0.18.8 (line 18)
    "NetworkError: 500 Internal Server Error -

    I tried again posting from chrome

    I also get this message when clicking post discussion and image seemingly finished uploading.

    it showed uploaded 97% after a few minutes on my slow connection. the % disappears and a few seconds later. An icon showing where image is uploaded (but seemingly blank) whean it appears finished.

    shows waiting forum.... .... .com

    I click on post discussion and get this error in a popup box

    "Code":256,"Exception":"Table 'db261120438.GDN_discussion' doesn't exist|Gdn_Database|Query|select CategoryID\nfrom GDN_discussion discussion\nwhere DiscussionID = :DiscussionID"}

    the discussion actually posts though but the image doesn't appear.

    I'm stumped unless it is a socket timeout issue or a sql timeout.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    hgtonighthgtonight ∞ · New Moderator

    Have you run http://www.example.com/forum/dashboard/utility/structure after your upgrade?

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    returns:-

    The following structure changes are required for your database.

    update GDN_User User set
    Permissions = ''
    where Permissions <> '';

    "Run Structure and Data Scripts" ?

  • Options

    "Run Structure and Data Scripts" runs:-

    http://www.example.com/forum/dashboard/utility/structure/all/0/0/0

    is that what I need to do?

  • Options
    peregrineperegrine MVP
    edited September 2013

    @hgtonight said:
    Have you run http://www.example.com/forum/dashboard/utility/structure after your upgrade?

    yes it was run after upgrade.

    wouldn;t hurt to do it again. doesn;t explain why a small jpg uploads fine, does it?

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    @avantime4mike said:
    "Run Structure and Data Scripts" runs:-

    is that what I need to do?

    yes.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    "The structure was successfully executed."

    Thanks guys, hasn't fixed the problem though.
    Bedtime here in UK, catch up tomorrow. Thanks again.

  • Options
    peregrineperegrine MVP
    edited September 2013

    {"MediaResponse":{"Status":"success","MediaID":"1610","Filename":"miketest.jpg","Filesize":829401,"FormatFilesize":"810K","ProgressKey":"1379539657766_UploadAttachment_2","PreviewImageLocation":"\/forum\/utility\/thumbnail\/FileUpload\/37\/91fae6c122295ceb38402693f10d30.jpg","FinalImageLocation":"http:\/\/XXXXXXXXXXX.com\/forum\/uploads\/FileUpload\/37\/91fae6c122295ceb38402693f10d30.jpg"},"FormSaved":true,"DeliveryType":"VIEW","Data":"","InformMessages":[],"ErrorMessages":"","RedirectUrl":""}

    I successfully loaded the jpg in a comment as a second attachment.

    just took seven minute from my machine :)

    and the thumbnail looks odd and broken when uploading large image,
    but looks when uploading a small.jpg

    the resolution for large image was ... 1920 x 2560

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    peregrineperegrine MVP
    edited September 2013

    also make sure the /uploads/thumbnail folder has the same permissions as the /uploads folder and look for the image in there.

    why does it point to utility?????????????????????

    the img src for the thumbnails icon

    "/forum/utility/thumbnail/FileUpload/37/91fae6c122295ceb38402693f10d30.jpg"

    beyond me....

    shouldn't it be pointing to the img src for the thumbnails icon it be pointing to the

    "forum/uploads/thumbnails/FileUpload/37/91fae6c122295ceb38402693f10d30.jpg"

    I would download the fileupload plugin and re-install it.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    Removed and re-installed, no different.

  • Options
    peregrineperegrine MVP
    edited September 2013

    @x00 - any idea why when uploading images the img src tag has the wrong path?

    /forum/utility/thumbnail ....

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    the link path is correct however, you can click on broken image of thumbnail and it goes to the correct image.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    mike,

    you should take a snapshot of the web page with the discussion with broken image in discussion
    and attach it here

    preferably with firebug or chrome developer showing the html tags.

    so people can understand what is happening.

    the file is actually uploading and uploads from what i have seen but takes a while and the thumbnail is broken.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    peregrineperegrine MVP
    edited September 2013

    I think I solved your problem.

    Your title is a misnomer (the upload seemingly works), but the thumbnail doesn't, probably because of the code here cannot work because of file permissions on your thumbnail folder.

         $TargetPath = MediaModel::PathUploads()."/thumbnails/$SubPath";
          if (!file_exists(dirname($TargetPath))) {
             mkdir(dirname($TargetPath), 0777, TRUE);
          }
          Gdn_UploadImage::SaveImageAs($Path, $TargetPath, $Height, $Width, $Options);
    
          // Cleanup if we're using a scratch copy
          if ($Path != MediaModel::PathUploads().'/'.$SubPath)
             @unlink($Path);
    
          $Url = MediaModel::Url("/thumbnails/$SubPath");
          Redirect($Url, 302);
    //      Gdn_FileSystem::ServeFile($TargetPath, basename($Path), '', 'inline');
    

    You probably do not have write permissions for the php owner on the thumbnail directory. thought you checked it already but make sure this file is writeable by the php owner.

    forum/uploads/thumbnails

    e.g. same permissions as set on this folder

    forum/uploads/FileUpload (since this works)

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options

    Permissions for Thumbnails set as per Fileupload.

    No difference I'm afraid.

  • Options

    Surely it must be a timeout or filesize thing.

  • Options
    peregrineperegrine MVP
    edited September 2013

    the file is uploading fine - so it is not filesize.

    the problem is thumbnail creation and location of thumbnail

    please post the file permissions of folder in a snapshot - need to see the owner and
    if it is writeable.

    forum/uploads/thumbnails

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.