<?php
function additional_image_rest(){

    register_rest_field(array("news","markets",'tutorials','venders','forum', 'top_forums',"tlg_channels","other_services"), '_additional_image', array(
            'get_callback' => function (){
	            global $post;
                $image_value = get_post_meta($post->ID, '_additional_img',true);
                $image_data = wp_get_attachment_image_src($image_value, 'full');
                wp_reset_postdata();
                return $image_data;
            }
    ));
}
add_action('rest_api_init', 'additional_image_rest' );


function register_rest_images(){
    register_rest_field( array("news","markets",'tutorials','venders','tlg_channels','other_services','forum','top_forums'),
        '_img',
        array(
            'get_callback'    => 'drk_get_rest_featured_image',
            'update_callback' => null,
            'schema'          => null,
        )
    );
}
function drk_get_rest_featured_image( $object, $field_name, $request ) {
    if( $object['featured_media'] ){
        $img = wp_get_attachment_image_src( $object['featured_media'], 'app-thumb' );
        if(isset($img[0])){
            return $img[0];
        }else{
            return null;
        }
    }
    return false;
}
add_action('rest_api_init', 'register_rest_images' );