@deep/nest-kit
    Preparing search index...

    Class BaseImageRenditionsService<IR>

    Image renditions service Helps to work with image renditions

    Type Parameters

    Index

    Constructors

    Properties

    dataSource: DataSource
    idService: IdService
    loggerFactory: WinstonLoggerFactory
    moduleRef: ModuleRef

    Accessors

    • get repository(): Repository<IR>

      Returns Repository<IR>

    Methods

    • Create image rendition

      Parameters

      Returns Promise<IR>

      created image rendition

      const imageRendition = await this.imageRenditionsService.create({
      imageId: 'hcimg:xxxxxxxxxxx',
      type: ImageRenditionType.SMALL,
      url: 'https://example.com/image.jpg',
      meta: {
      width: 100,
      height: 100,
      mimeType: 'image/jpeg',
      fileSize: 20344,
      },
      });
    • Delete image rendition

      Parameters

      Returns Promise<void>

      await this.imageRenditionsService.delete('hcimgr:xxxxxxxxxxx');
      
    • Returns string

    • Get image rendition list

      Parameters

      Returns Promise<[IR[], ListMeta]>

      image rendition list

      const [imageRenditions, meta] = await this.imageRenditionsService.getMany({
      orderBy: ImageRenditionsOrderBy.type_ASC,
      limit: 10,
      filter: {
      imageId: 'hcimg:xxxxxxxxxxx',
      },
      });
    • Get image rendition by id

      Parameters

      • id: string

        image rendition id

      Returns Promise<MaybeNull<IR>>

      image rendition if exists or null

      const imageRendition = await this.imageRenditionsService.getOne('hcimg:xxxxxxxxxxx');
      
    • Get image rendition with specific type for image

      Parameters

      Returns Promise<MaybeNull<IR>>

      image rendition if exists or null

      const imageRendition = await this.imageRenditionsService.getOneByImageId({
      imageId: 'hcimg:xxxxxxxxxxx',
      type: ImageRenditionType.SMALL,
      });
    • Get image rendition url

      Returns Promise<MaybeNull<string>>

      const url = await imageRenditionsService.getUrl({
      type: ImageRenditionType.SMALL,
      imageId: 'hcimg:xxxxxxxxxxx',
      });
    • Returns void