Skip to content

HFS plugin to show thumbnails for images in place of icons. Works best on "tiles mode" (enable it in frontend's options).

License

Notifications You must be signed in to change notification settings

rejetto/thumbnails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Thumbnails

HFS plugin to show thumbnails for images in place of icons. Works best on "tiles mode" (enable it in frontend's options).

Plugin "sharp" will be automatically installed because it's necessary for this plugin to work.

image

Extendable

This plugin is extendable: other plugins can add support for more formats without having to care of all details, just the minimum. Let's say you want to create a plugin that adds PDF support to thumbnails. You should do something like:

exports.onDirEntry = ({entry}) => {
    if (entry.n.endsWith('.pdf'))
        entry._th = 1
}

exports.customApi = {
    thumbnails_get({ ctx, path }) {
        if (path.endsWith('.pdf')) {
            const thumbnailImage = ...your code to generate the thumbnail
            return thumbnailImage
        }
    }
}

There's an alternative way to the onDirEntry, and it's to define a frontend_js with this

HFS.onEvent('thumbnails_supported', ({ entry }) =>
    entry.n.endsWith('.pdf') )

About

HFS plugin to show thumbnails for images in place of icons. Works best on "tiles mode" (enable it in frontend's options).

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •