mdo:thumbnail issue?

Developer
Sep 21, 2010 at 11:32 PM
Edited Sep 21, 2010 at 11:34 PM

Hi Anton,

I'm testing with mdo:thumbmail, but get a strange result: the thumbnail is generated in a folder, but function returns a wrong virtual path.

For example this call:

 

<img src="{mdo:thumbnail('/Portals/0/Img/XSLideshow/XSLideshow_settings_010002.png', 72, 72)}" />
 

is returning me the path:

 

/Portals/0/XsltDbFiles/ow/XSLideshow_settings_010002.png.thumb/72x72.png

 

while the image is correctly generated as 

/Portals/0/Img/XSLideshow/XSLideshow_settings_010002.png.thumb/72x72.png

 

I gave a quick look at the code and saw no errors, maybe the problem is in thumbnail function? At line 184 of helper2.cs:

string tpath = m.RelativeName(thumbPath);

m is an instance of FileMan, and its CreateFileManager() calls getFilesRoot() to get the root folder - but this is read from appsettings (XsltDbFiles folder).

Could be?

 

 

 

Coordinator
Sep 22, 2010 at 6:45 AM

Alberto,

mdo:thumbnail works only with XsltDb files repository and accepts path relative to the repository. By default repository is created under portal home in XsltDbFiles folder. In AppSetings you can provide custom location under DNN root folder. 

I can provide another version of thumbnail that will work with any file. I think I' issue new release on Friday or Saturday this week.

Working with images I realized that it is better to use a handler or a special aspx to return thumbnails as this allows flexible control of browser cache. Have a look at XsltDb\jpg.aspx file. It also works only with XsltDb files repository.

Actually, repository can be used as follows

  • mdo:request-file() - upload file into repository (requires <input type="file" />). returns relative path of new file in repository
  • mdo:thumbnail() - creates and caches thumbnail, acceps path, relative to repository root,
  • mdo:virtual-file() returns virtual path for repative repository path
Developer
Sep 22, 2010 at 7:48 AM

Anton,

I should have remembered this - instructions just tell to pass a "relative path to the source image" for the path parameter, so I tried ;)

Well I can use that folder: I just would want to keep the control on folder names (if I use request-file the module creates a structure like "2010/09/20/filename.zip" under XsltDbFiles), but I could use for example file manager to upload files to a custom folder (eg "myfolder" under XsltDbFiles), and then use mdo:thumbnail above it. It is not possible to handle custom folders via request-file, is it?

Else it would be nice to have a new thumbnail function to handle any file in portal. You could also add the possibility to add a watermark (with an image or text, see for example this article) :-)

 

Coordinator
Sep 22, 2010 at 10:43 AM
trapias wrote:

 but I could use for example file manager to upload files to a custom folder (eg "myfolder" under XsltDbFiles), and then use mdo:thumbnail above it. It is not possible to handle custom folders via request-file, is it?

Else it would be nice to have a new thumbnail function to handle any file in portal. You could also add the possibility to add a watermark (with an image or text, see for example this article) :-)

 

Yes, there's no way to assign custom path under XsltDbFiles folder. And this is not good idea to mix portal files and xsltdb files. I plan to make XsltDbFiles folder hidden to prevent DNN file manager looking into it. XsltDb files repository has two objectives:

  1. provide storage mechanism for millions of files.
  2. provide a separate folder for each article on site with thousands of articles (this is not delivered yet).

Manual folder management is not something you'd like to do in these cases.

Therefor I'll better provide alternative thumbnail generation toolset for portal files. And I'll add watermarks of cource :-).

Developer
Sep 22, 2010 at 11:05 AM

Anton,

I agree, better to keep things separated. Just one question: when you save files to XsltDbFiles original names are changed and path is automatically created based on current date: so you normally save the path returned from mdo:request-file to some custom table, in order to later reuse that file in some specific page/function? 

Waiting for next version :-))

Coordinator
Sep 22, 2010 at 3:19 PM

Exactly.

Or you can query Findy_XsltDb_Files for FileID