files upload but no thumbnails are generated
![hbf](https://us.v-cdn.net/5018160/uploads/userpics/011/nSIIP7OFKIPGZ.jpg)
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.
1
Answers
I'm facing the same identical issue.
(Hello to everybody, this is my first post. I'm a newbie with Vanilla)
@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:
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
unfortunately i can't get the code to show up properly...
remove the parenthesis () around the tag < and /> on the img tags
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
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![:) :)](https://open.vanillaforums.com/plugins/emojiextender/emoji/little/smile.png)