This project is read-only.
1

Closed

Thumbnails and preview are not working

description

Hi, I noticed a few issues where preview and thumbnails are not working.

I fixed the issues in a local copy, I'll now try to create a fork + pull request (new to this...), if that's ok? Pull request should be finished somewhere tomorrow.
Closed May 6, 2014 at 6:59 AM by KZmorzynski
No feedback from issuer.

comments

KZmorzynski wrote Apr 24, 2013 at 10:47 PM

hi,

thank you for feedback. Could you please describe the problem more deeply?
As for the full request, you're most welcome.

thank you,
Chris

bertvan wrote Apr 25, 2013 at 5:56 AM

When opening elFinder, the thumbnail images are not shown (in the icons). Also, when right-clicking an image and choosing "Preview", the preview is not shown.

When opening "Preview", the javascript console says: elfinder debug: [error] [image-fileselector-container] TypeError {}

I found that the problem was that no thumbnails were being generated.

This was due to two problems:
  • When saving the thumbnail after creating it with GDI, if the folder does not exist (yet) it throws.
  • When configuring the connector with full paths for thumbnails (instead of relative ones), the code stops processing the thumbnail at LocalFileSystemVolume.createFileModel
I first raised the issue at elFinder, but then found out the problem was in the connector. https://github.com/Studio-42/elFinder/issues/567

KZmorzynski wrote Apr 27, 2013 at 2:16 PM

Ok, I checked your pull request and have following concern: you changed those lines:
if( !_config.LocalFSThumbsDirectoryPath.Contains( fi.DirectoryName ) )
{
    // check if thumbnail exists - cache it maybe?
    string thumbnailPath = _config.LocalFSThumbsDirectoryPath + Path.DirectorySeparatorChar + hash + fi.Extension;
    if( File.Exists( thumbnailPath ) )
        thumbnail = hash + fi.Extension;
    else
        thumbnail = Model.FileModel.ThumbnailIsSupported; // can create thumbnail
}
into:
string thumbnailPath = "";
if (!_config.LocalFSThumbsDirectoryPath.Contains(fi.DirectoryName))
{
    // tmb path set as dirname under root dir

    // check if thumbnail exists - cache it maybe?
    thumbnailPath = _config.LocalFSThumbsDirectoryPath + Path.DirectorySeparatorChar + hash + fi.Extension;
}
else
{
    // tmb path as full path
    thumbnailPath = _config.LocalFSThumbsDirectoryPath + Path.DirectorySeparatorChar + hash + fi.Extension;
}

if (File.Exists(thumbnailPath))
{
    thumbnail = hash + fi.Extension;
}
else
{
    thumbnail = Model.FileModel.ThumbnailIsSupported; // can create thumbnail
}
The reason for the first "if", is to ensure that we won't generate thumbnails for files in thumbnails directory, so that we won't generate thumbnails recursively.
In your change, those thumbnails will always be generated, which is a bad idea in my opinion.

You mentioned that there are problems generating thumbnails when full (absolute) paths are set in web.config - but right now they are set as absolute paths and thumbnails should generate. Could you please explain it a little more? Which exactly settings did you have in mind and with what values?