I want to be able to programatically keep track of new images that have been added, so that I can periodically run a script that does something with the new images. My idea is to have a plugin that can listen for the event of someone adding a new image, and append its file path to a list.

Does such an event exist? Does it depend on how the image gets added? (For example they might upload the image through the media manager or through the J2Store product interface.)

1 Answer 1


Does such an event exist?

Core com_media component uses the same events as other core components: onContentBeforeSave, onContentAfterSave, onContentBeforeDelete and onContentAfterDelete. You'll need to check that context is com.media.file, e.g.:

public function onContentAfterSave($context, $item, $isNew)
    if ($context !== 'com_media.file')

    // Add your code here.

Does it depend on how the image gets added?

Yes, other extensions may trigger different events.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.