files upload but no thumbnails are generated

hbfhbf MVP
edited December 2011 in Vanilla 2.0 - 2.8

when a user uploads a file the original file is placed in the uploads/fileupload/XXX directory and the thumbnails XXX directory is created, but no thumbnail is placed in the directory.

any help would be appreciated. thanks.

Best Answer

  • Found a nasty workaround bypassing the creation of the thumbnail and displayng directly the final image. I modified the file class.fileupload.plugin.php
    The function modified is: public function PostController_Upload_Create($Sender)
    Find the statement:
    $MediaResponse = array(
    'Status' => 'success',...

    and replace

    'PreviewImageLocation' => Url($PreviewImageLocation),

    with

    'PreviewImageLocation' => Url(MediaModel::Url($Parsed['Name'])),

    And you're done. My final code looks like this:

    $MediaResponse = array(
    'Status' => 'success',
    'MediaID' => $MediaID,
    'Filename' => $FileName,
    'Filesize' => $FileSize,
    'FormatFilesize' => Gdn_Format::Bytes($FileSize,1),
    'ProgressKey' => $Sender->ApcKey ? $Sender->ApcKey : '',
    'PreviewImageLocation' => /Url($PreviewImageLocation)/ Url(MediaModel::Url($Parsed['Name'])),
    'FinalImageLocation' => Url(MediaModel::Url($Parsed['Name']))
    );

    Hope to be helpful.

Answers

  • edited December 2011

    I'm facing the same identical issue.

    (Hello to everybody, this is my first post. I'm a newbie with Vanilla)

  • hbfhbf MVP
    edited December 2011

    @foxmulder74

    while i really want to get this resolved properly, i have a small hack to the fileupload add-on which mitigates the problem.

    open link_files.php
    find $ThumbnailUrl = MediaModel::ThumbnailUrl($Media);
    and comment it, and the next line out. and add a new line

    $Img .= '(<) img src="'.$DownloadUrl.'" width=100% (/>)';

    here is what mine looks like:

    /*following lines are original code commented out for thumbnailing issue*/
                      
                      /*$ThumbnailUrl = MediaModel::ThumbnailUrl($Media);
                      
                      $Img .= Img($ThumbnailUrl, array('class' => 'ImageThumbnail'));*/
                      
                      /*next line is temporary hack to resolve thumbnailing issue. */
                      $Img .= '(<)img src="'.$DownloadUrl.'" width=100%(/>)';
  • hbfhbf MVP
    edited December 2011

    unfortunately i can't get the code to show up properly...

    remove the parenthesis () around the tag < and /> on the img tags

  • This workaround seems to work great when the discussion in viewed by the user.
    Thanks a lot.
    Now I'm trying to replicate it where the user actually do the upload, which is still not working. I will keep you informed.
    Thanks again.

  • Found a nasty workaround bypassing the creation of the thumbnail and displayng directly the final image. I modified the file class.fileupload.plugin.php
    The function modified is: public function PostController_Upload_Create($Sender)
    Find the statement:
    $MediaResponse = array(
    'Status' => 'success',...

    and replace

    'PreviewImageLocation' => Url($PreviewImageLocation),

    with

    'PreviewImageLocation' => Url(MediaModel::Url($Parsed['Name'])),

    And you're done. My final code looks like this:

    $MediaResponse = array(
    'Status' => 'success',
    'MediaID' => $MediaID,
    'Filename' => $FileName,
    'Filesize' => $FileSize,
    'FormatFilesize' => Gdn_Format::Bytes($FileSize,1),
    'ProgressKey' => $Sender->ApcKey ? $Sender->ApcKey : '',
    'PreviewImageLocation' => /Url($PreviewImageLocation)/ Url(MediaModel::Url($Parsed['Name'])),
    'FinalImageLocation' => Url(MediaModel::Url($Parsed['Name']))
    );

    Hope to be helpful.

  • Thanks for useful bug. I was need to DISABLE thumbnails by replacing them with file types icons. So I reverted your solution :)

Sign In or Register to comment.