Hook after attachment added and cropped

There is to filters needed for optimizing all images, that will be uploaded: add_filter(‘wp_handle_upload’, ‘random_function’, 10, 2); add_filter(‘image_make_intermediate_size’, ‘rand_function2’, 10, 1); function random_function($array, $string) { // Some random action with main image return $array } function rand_function2($file) { // Some random action with cropped images return $file }