<?php
/**
 * Created by PhpStorm.
 * User: marco
 * Date: 20/07/18
 * Time: 21.16
 */
function responsive_image( $image_size = 'rect' ) {

    $acf_image = '';
    $wp_image  = '';
    global $post;
    $postObject          = $post;
    $postID              = $post->ID;
    $pagePostThumbnailID = $postID;
    $post_title          = $post->post_title;

    if ( class_exists( 'acf' ) ) {
        $acf_image = get_field( 'main_image' );

        if ( ! empty( $acf_image ) ) {

//			$desktopImageSize = $image_size;
//			$mobileImageSizes = 'quad';

            $image = $acf_image['sizes'][ $image_size ];
            //$immagine_sfondo_mobile = $slide['immagine_sfondo_mobile'];

//			if ( empty( $immagine_sfondo_mobile ) ) {
//				$immagine_sfondo_mobile = $immagine_sfondo;
//			}
//
//			$widthDesktop  = $immagine_sfondo['sizes'][ $desktopImageSize . '-width' ];
//			$heightDesktop = $immagine_sfondo['sizes'][ $desktopImageSize . '-height' ];
//
//			$widthMobile  = $immagine_sfondo_mobile['sizes'][ $mobileImageSizes . '-width' ];
//			$heightMobile = $immagine_sfondo_mobile['sizes'][ $mobileImageSizes . '-height' ];
//
//			$ratioWidthHeight = [ $widthDesktop, $heightDesktop, $widthMobile, $heightMobile ];
//
//			$immagine        = $immagine_sfondo['sizes'][ $desktopImageSize ];
//			$immagine_mobile = $immagine_sfondo_mobile['sizes'][ $mobileImageSizes ];
//			$alt             = $immagine_sfondo['alt'];
//			var_dump( $image );

        }

    }

    //fine model, se presente vai di view:
    if ( ! empty( $image ) ) : ?>
        <div class="main-image">
            <div class="main-image__image-container img-responsive-container">
                <img src="<?php echo $image; ?>" alt="<?php echo $post_title; ?>">
            </div>
        </div>
    <?php endif;

}