Extend ScreenGlow with Hooks
Developers can extend ScreenGlow functionality using hooks. The following hook is available:
screenglow_image_saved – Action hook fired when a new image is saved using ScreenGlow. The hook passes:
- New attachment id
- Full file path of new image
- File type of the saved image (eg: png)
/**
* @param int $attach_id The attachment ID of the saved image.
* @param string $upload_path The full file path of the saved image.
* @param string $file_type The file type of the saved image.
*/
add_action('screenglow_image_saved', function($attachment_id, $file_path, $file_type) {
// Add a custom meta field to the attachment
update_post_meta($attachment_id, '_screenglow_processed', 'yes');
// You could also perform additional processing on the image here
// For example, generate a thumbnail, send a notification, etc.
}, 10, 3);