change the return value to image array (or object) then change every instance in the original code is getting the image field so that the values are not formatted
this will preserve the all of the original code with the minimum amount of alteration and allow you to use the full image array.
Then to add your additional code you can get the field again in the original way.
Either that or use
$alt = get_post_meta(get_sub_field(image), '_wp_attachment_image_alt', true);
to get the alt text for the image
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.