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

Thumbnails don't work properly when RewriteURLs is turned on

running on nginx with the following rewrites:

location / {
try_files $uri $uri/ @forum;
}

location @forum {
rewrite ^/(.+)$ /index.php?p=$1 last;
}

When RewriteURLs = FALSE, then previews show properly and thumbnails are saved in /uploads/thumbnails/FileUpload. However when RewriteURLs = TRUE then thumbnails are not saved and the location it is looking for the thumbnail in is /utility/thumbnail/FileUpload, which doesn't exist.

How is the thumbnail path being generated and why does it change with RewriteURLs turned on?

Thanks

Comments

  • Options
    peregrineperegrine MVP
    edited November 2013

    Welcome to the Community.

    should we guess your version of vanilla? Depending on version of vanilla - the answer and solution may be different.

    good find. I wonder if its replicateable in apache with the same version you are using.

    thse might help.

    http://vanillaforums.org/discussion/23130/forum-post-ettikett-etiquette

    http://vanillaforums.org/discussion/17954/food-for-thought-forum-etiquette

    http://vanillaforums.org/discussion/25115/how-to-how-can-a-new-user-better-help-the-community-when-asking-a-question

    there have been a few recent discussions pertaining to thumbnails that may provide insight if you search forum on thumbnail

    probably in here class.mediamodel.php or here class.fileupload.plugin.php

    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

    I am running 2.0.18.8

    I found this in class.mediamodel.php:

    $Path = ltrim(GetValue('Path', $Media), '/');
      if ($RequiresThumbnail) {
         $ThumbPath = MediaModel::PathUploads()."/thumbnails/$Path";
         if (file_exists(MediaModel::PathUploads()."/thumbnails/$Path"))
            $Result = "/uploads/thumbnails/$Path";
         else
            $Result = "/utility/thumbnail/$Path";
      } else {
         $Result = "/uploads/$Path";
      }
      return $Result;
    

    Which would seem to imply that is is checking for the file in "/uploads/thumbnails/$Path", but not finding it (when RewriteURLs is turned on), so it's returning "/uploads/$Path".

    I am new to Vanilla, so please bear with me :)

  • Options

    Returning "/utility/thumbnail/$Path" I mean...

  • Options
    peregrineperegrine MVP
    edited November 2013

    I tested on apache with rewrite TRUE and FALSE

    worked both ways.

    { rewrite ^/(.+)$ /index.php?p=$1 last; }

    should it be (I am not good at rewrite rules and no nothing much about nginx rewrites

    { rewrite ^/(.*)$ /index.php?p=$1 last; }

    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

    This seems to have fixed the issue. Added additional rewrite rule

    location ^~ /utility/thumbnail/ { rewrite ^/(.+)$ /index.php?p=$1 last;}
    

    as found here
    http://vanillaforums.org/discussion/22736/fileupload-don-t-create-thumbnails-if-rewriteurls-true

Sign In or Register to comment.