|
@@ -94,6 +94,15 @@ func (r *RouterDir) OpenFile(ctx context.Context, name string, flag int, perm os
|
|
|
r.renderer.RenderThumbnail(filepath.Join(r.FsPath, name, entry.Name()), outputFolder)
|
|
|
}()
|
|
|
}
|
|
|
+ } else {
|
|
|
+ //Requested a file path. Render the thumbnail
|
|
|
+ outputFolder := filepath.Join(r.ThumbStore, name)
|
|
|
+ if err := os.MkdirAll(filepath.Dir(outputFolder), 0755); err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ //The RenderThumbnail function will immeidiately return if the thumbnail already exists
|
|
|
+ //If the thumbnail is not present, it will be generated in real time
|
|
|
+ r.renderer.RenderThumbnail(filepath.Join(r.FsPath, name), outputFolder)
|
|
|
}
|
|
|
|
|
|
fmt.Println("[Bokothumb]", "OpenFile called to "+name)
|