Added image tagging and object detection after generaing jpeg thumbnail

This commit is contained in:
Alex 2022-06-21 18:00:30 -05:00
parent ad36b8b10f
commit 63bebd92e0
No known key found for this signature in database
GPG key ID: 53CD082B3A5E1082

View file

@ -20,6 +20,9 @@ export class ThumbnailGeneratorProcessor {
private thumbnailGeneratorQueue: Queue,
private wsCommunicateionGateway: CommunicationGateway,
@InjectQueue('metadata-extraction-queue')
private metadataExtractionQueue: Queue,
) {}
@Process('generate-jpeg-thumbnail')
@ -48,6 +51,8 @@ export class ThumbnailGeneratorProcessor {
asset.resizePath = jpegThumbnailPath;
await this.thumbnailGeneratorQueue.add('generate-webp-thumbnail', { asset }, { jobId: randomUUID() });
await this.metadataExtractionQueue.add('tag-image', { asset }, { jobId: randomUUID() });
await this.metadataExtractionQueue.add('detect-object', { asset }, { jobId: randomUUID() });
this.wsCommunicateionGateway.server.to(asset.userId).emit('on_upload_success', JSON.stringify(asset));
}
});
@ -72,6 +77,8 @@ export class ThumbnailGeneratorProcessor {
asset.resizePath = jpegThumbnailPath;
await this.thumbnailGeneratorQueue.add('generate-webp-thumbnail', { asset }, { jobId: randomUUID() });
await this.metadataExtractionQueue.add('tag-image', { asset }, { jobId: randomUUID() });
await this.metadataExtractionQueue.add('detect-object', { asset }, { jobId: randomUUID() });
this.wsCommunicateionGateway.server.to(asset.userId).emit('on_upload_success', JSON.stringify(asset));
})