Possible to add “Even/Odd Classes” to image attachments via wp_get_attachment_image?

wp_get_attachment_image() has a fourth parameter for custom attributes. Use it:

if ( count( $images ) > 0 ) {
    $i = 0;
    foreach ( $images as $image ) {
        echo wp_get_attachment_image( 
            $image->ID, 
            'photogallery-img',
            FALSE,
            array (
                'class' => 'attachment-photogallery-img ' 
                . ( ( $i++ % 2 === 0 ) ? 'even' : 'odd' )
            )
        );
    }
}

tech