Skip to content

Document thumbnail converter

Variants images for thumbnail Document are generates by libreoffice-file-converter. Make sure you have LibreOffice installed on your system.

It is possible to specify the path of binaries. Useful if your installations are specific or if you are dropping off precompiled versions.

Installation required:

sh
npm install libreoffice-file-converter
sh
pnpm install libreoffice-file-converter
sh
yarn add libreoffice-file-converter

Configuration

typescript
// config/attachment.ts
export default defineConfig({
  converters: [
    { 
      key: 'preview',
      converter: () => import('@jrmc/adonis-attachment/converters/document_thumbnail_converter'),
    }
  ]
})

By default, image format is JPEG and size is video size. options attribute use image_converter

Sample:

typescript
export default defineConfig({
  converters: [
    { 
      key: 'preview',
      converter: () => import('@jrmc/adonis-attachment/converters/document_thumbnail_converter'),
      options: {
        format: 'webp',
        resize: 720
      }
    }
  ]
})