Setting featured image with function, 1 part not working

You have to set the $single paramter of get_post_meta to false (or don’t set it) to get an array.

Here is a sped-up version:

    if ($attachment_id = get_post_meta($post_id, 'featured_image',      true)) :
elseif ($attachment_id = get_post_meta($post_id, 'upload_single_image', true)) :
elseif ($attachment_id = get_post_meta($post_id, 'create_gallery',     false)) :
    $attachment_id = $attachment_id[0]['upload_image'];
endif;

Note: I did not test this.


// EDIT
Here is the code with the ACF function:

    if ($attachment_id = get_post_meta($post_id, 'featured_image',      true)) :
elseif ($attachment_id = get_post_meta($post_id, 'upload_single_image', true)) :
elseif ($gallery = get_field('create_gallery', $post_id)) :
    $attachment_id = $gallery[0]['upload_image'];
endif;