HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Thumbnail

Why is that the thumbnail URL is having a "utility" directory?

After the attachment, it shows a broken image with this path: http://localhost/vanillaTest/utility/thumbnail/8/Uploader/8b/1d158f47abbfd08c796cddf94fbddb.png

Comments

  • hgtonighthgtonight ∞ · New Moderator

    It is serving up the image through the utility controller.

    Why it is doing that is something you need to ask @vrijvlinder

    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.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Did you select file types allowed in the settings ?

    I think this happens in the event that there is no thumbnail .

  • This is what happens. Please look for the src URL of the thumbnail image

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited March 2015

    Have you tried the latest version 1.3 ? I believe I fixed the issue. Which has to do with the image being too large to make a thumbnail. The link works and you can insert it. Just that no thumbnail is created hence the utility thumbnail which acts as a temp thumbnail.

    I can't test locally so I don't know if the issue has something to do with that. I would need to see your site and have an account made so I can replicate what is happening. But if your site is not live, then I can't do much.

    Try uploading a small image and see if it makes a thumbnail . I see something is wrong with the url to the image.

    It is creating a double directory ...

    the url should be <img src="/vanilla/plugins/Uploader/utility/thumbnail/toobig.png" class="ImageThumbnail">

    You can try this to fix but I am not sure, find line 167 and look for this in class.mediamodel.php

     $Path = ltrim(GetValue('Path', $Media), '/');
          if ($RequiresThumbnail) {
            $Result = Gdn_Upload::Url(ltrim(GetValue('ThumbPath', $Media), '/'));
           }elseif($RequiresThumbnail){
            $Result = Gdn_Url::Url('plugins/Uploader/utility/thumbnail/toobig.png');
          }else {
             $Result = Gdn_Upload::Url($Path);
          }
          return $Result;
    }
    

    Change to this and see if it works for you

     $Path = ltrim(GetValue('Path', $Media), '/');
          if ($RequiresThumbnail) {
            $Result = Gdn_Upload::Url(ltrim(GetValue('ThumbPath', $Media), '/'));
           }elseif($RequiresThumbnail){
            $Result = Gdn_Url::Url('/vanilla/plugins/Uploader/utility/thumbnail/toobig.png');
          }else {
             $Result = Gdn_Upload::Url($Path);
          }
          return $Result;
    }
    

    Or this

    $Path = ltrim(GetValue('Path', $Media), '/');
              if ($RequiresThumbnail) {
                $Result = Gdn_Upload::Url(ltrim(GetValue('ThumbPath', $Media), '/'));
               }elseif($RequiresThumbnail){
                $Result = Gdn_Url::Url('/plugins/Uploader/utility/thumbnail/toobig.png');
              }else {
                 $Result = Gdn_Upload::Url($Path);
              }
              return $Result;
        }
    
  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Ok I tried something else to mitigate this issue. Please try version 1.4 and report if it works or not for you.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited March 2015

    I discovered a bug with Uploader which has to do with the php.ini settings I added the file to the forum root folder to see if the settings corrected the problem and it seems it does but this has to be done at server level. It may not be allowed to add this file on all hosting but you may be able to edit the settings or ask them to.

    It will be required to edit the php.ini settings

    memory_limit = 128M
    upload_max_filesize = 10M
    post_max_size = 10M
    
  • thanks @vrijvlinder , I tried the php.ini workaround that you've suggested but the problem still exist. my PHP version is 5.4. What is the version of yours?

  • rmhlrmhl New
    edited March 2015

    Tried the version 1.4. Still no good but the src URL changed. I don't have any utility folder.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Does this happen with any image ? I don't have that problem unless it is a very large image meaning it is 4000px wide... I tested with and without

    I am sorry this is not working for you. Are you able to insert it ? Are you able to delete it? when you hover it?

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited March 2015

    I am using php5.3 by the way... not sure that has anything to do with it. The error is caused by memory allocation.

    memory_limit= 32M

    post_max_size=20M

    If you look at the cgi error logs during an upload, you can see the error. Trying to use 32M but requires 64M. So it exhausts the available memory trying over and over in a loop. This issue is a known issue with Wordpress and Drupal and anything that uses php .

    https://www.drupal.org/node/207036

    https://wordpress.org/support/topic/memory-exhausted-error-in-admin-panel-after-upgrade-to-28?replies=66

    https://www.airpair.com/php/fatal-error-allowed-memory-size

    http://www.serkey.com/sphinx-fatal-error-allowed-memory-size-of-bytes-exhausted-bbvaxx.html

Sign In or Register to comment.