Skip to content

Changelog

2.4.2

  • fix: issue #2, cannot read properties of undefined (reading 'getConfig')
  • fix: delete old file after option rename changed

2.4.1

  • fix: typo error mimetype -> mimeType

2.4.0

  • feat: use queue by Model attributes Attachment
  • feat: ace command for generate converter
sh
node ace configure @jrmc/adonis-attachment

or add () => import('@jrmc/adonis-attachment/commands') in array commands on adonisrc.ts

2.3.2

  • fix: remove file after set attributes Attachment at null

2.3.1

2.3.0

2.2.0

2.1.0

  • you may set the ffmpeg and ffprobe binary paths manually
  • add config to disable meta
  • add config to disable rename

2.0.2

  • fix README
  • fix documentation

2.0.1

⚠️ BREAKING CHANGE

sh
node ace add @adonisjs/drive
  • basePath is deleted, replace by location option of fs service in drive config

config/attachment.ts

typescript
import { defineConfig } from '@jrmc/adonis-attachment'
import app from '@adonisjs/core/services/app'

export default defineConfig({
  basePath: app.publicPath(), 
  converters: [
    //...
  ]
})

sample config/drive.ts for compatibility old location attachment package version < 2.0.0

typescript
import env from '#start/env'
import app from '@adonisjs/core/services/app'
import { defineConfig, services } from '@adonisjs/drive'

const driveConfig = defineConfig({
  default: env.get('DRIVE_DISK'),

  services: {
    fs: services.fs({
      location: app.publicPath(), 
      serveFiles: true,
      routeBasePath: '/uploads',
      visibility: 'public',
    }),
  },
})

export default driveConfig

declare module '@adonisjs/drive/types' {
  export interface DriveDisks extends InferDriveDisks<typeof driveConfig> {}
}
  • Refacto getUrl() view helper, add await word
typescript
user.avatar.getUrl() 
await user.avatar.getUrl() 
  • Access serialize is update
typescript
user.avatar.toJSON() 
await user.avatar.toJSON() 
html
<img :src="user.avatar.thumbnail" loading="lazy" alt="" />
<img :src="user.avatar.thumbnail.url" loading="lazy" alt="" />
  • dependencies update

1.1.0

  • variantes videos thumbnail

1.0.1

  • support AdonisJS 6
  • attachment file by file system
  • save meta data
  • variantes images
  • serialize