Currently I’m trying to implement a library like Color Thief to find the dominant color of an image. I would like to hook into the Media Library when an image has been uploaded. This way Color Thief can get the dominant color and generate a new field for the image with the color hex.
I’ve tried adding the beforeCreate lifecycle at a new file located here: extensions/strapi-plugin-upload/models/File.js, but nothing is being triggerd when I upload a file.
For anyone who might stumble upon this post, I solved it by renaming strapi-plugin-upload to upload. That means the path is extensions/upload/models/File.js instead of extensions/strapi-plugin-upload/models/File.js
Does this approach work with Strapi v4? I’m looking to do something similar but I think there have been quite a few changes to how plugin lifecycle hooks work in v4.