if alt text exists
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
// if the image has alt text set, set $alt_text variable to that else to the Page title
if( ! empty( $image['alt'] ) ) {
$alt_text = $image['alt'];
} else {
$alt_text = get_the_title();
}