<?php
/**
 * Thumbnails
 *
 * @package Zeen
 * @since 1.0.0
 */

if ( ! function_exists( 'zeen_thumbnails' ) ) {
	function zeen_thumbnails() {

		$sizes = zeen_thumbnail_sizes();

		foreach ( $sizes as $key ) {
			$key[2] = empty( $key[2] ) ? true : $key[2];
			$key['h'] = 'full' == $key[1] ? '' : $key[1];
			if ( get_theme_mod( 'thumb_' . $key[0] . 'x' . $key[1], 1 ) == 1 ) {
				add_image_size( 'zeen-' . $key[0] . '-' . $key[1], $key[0], $key['h'], $key[2] );
			}
		}
	}
}
add_action( 'after_setup_theme', 'zeen_thumbnails' );
