<?php
/**
 * Creates a function for your featured image sizes which can be altered via your child theme
 * @package Impact WordPress Theme
 * @since 1.0
 * @author AJ Clarke : http://wpexplorer.com
 * @copyright Copyright (c) 2012, AJ Clarke
 * @link http://wpexplorer.com
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 */
 
 
/**
* Setup Default Image Cropping Sizes
* @Since 1.0
*/
if ( ! function_exists( 'wpex_img' ) ) :

	function wpex_img( $args ){
		
		
		/**
		* Blog Entries
		******************/
		
		$blog_style = of_get_option('blog_entry_style','large_image');

		// Width
		if( $args == 'recent_posts_entry_width' ) {
			if ( $blog_style == 'medium_image' ) {
				return '400';
			} elseif ( $blog_style == 'large_image' ) {
				return '650';
			} else {
				return '930';
			}
		}

		// Height
		if( $args == 'recent_posts_entry_height' ) {
			if ( of_get_option('blog_entry_thumbnail_crop', '1') == '1' ) {
				if ( $blog_style == 'medium_image' ) {
					return '200';
				} elseif ( $blog_style == 'large_image' ) {
					return '300';
				} else {
					return '450';
				}
			} else {
				return 9999;
			}
		}
		
		
		// Crop
		if( $args == 'recent_posts_entry_crop' ) {
			if ( of_get_option('blog_entry_thumbnail_crop', '1') == '1' ) {
				return true;
			} else {
				return false;
			}
		}
		

		/**
		* Blog Posts
		******************/
		
		// Width
		if( $args == 'blog_post_width' ) return '650';
		
		// Height
		if( $args == 'blog_post_height' ) {
			if ( of_get_option('blog_post_thumbnail_crop', '1') == '1' ) {
				return of_get_option('blog_post_thumbnail_height','300');
			} else {
				return '9999';
			}
		}

		// Crop
		if( $args == 'blog_post_crop' ) {
			if ( of_get_option('blog_post_thumbnail_crop', '1') == '1' ) {
				return true;
			} else {
				return false;
			}
		}
		

		/**
		* Portfolio Entries
		******************/
		if ( of_get_option('portfolio_archive_style' ) == 'masonry' ) {
			
			if( $args == 'port_entry_width' ) return of_get_option('portfolio_entry_img_width','450');
			if( $args == 'port_entry_height' ) return '9999';
			if( $args == 'port_entry_crop' ) return false;
		
		} else {
		
			if( $args == 'port_entry_width' ) return of_get_option('portfolio_entry_img_width','400');
			if( $args == 'port_entry_height' ) return of_get_option('portfolio_entry_img_height','300');
			if( $args == 'port_entry_crop' ) return true;
			
		}

		
		/**
		* Portfolio Posts
		******************/
		$portfolio_post_crop = ( of_get_option('portfolio_post_img_crop') == '1' ) ? true : false; 
		
		// Width
		if( $args == 'port_post_width' ) return '650';
		if( $args == 'port_post_full_width' ) return '940';
		if( $args == 'port_related_width' ) return '210';
		
		// Height
		if( $args == 'port_post_height' ) return of_get_option('portfolio_post_sidebar_img_height','9999');
		if( $args == 'port_post_full_height' ) of_get_option('portfolio_post_full_img_height','9999');
		if( $args == 'port_related_height' ) return '160';
				
		// Crop
		if( $args == 'port_post_crop' ) return $portfolio_post_crop;
		if( $args == 'port_post_full_crop' ) return $portfolio_post_crop;
		if( $args == 'port_related_crop' ) return true;
		

		/**
		* Staff Entries
		******************/
		
		// Width
		if( $args == 'staff_entry_width' ) return '450';
		if( $args == 'staff_entry_masonry_width' ) return '450';
		
		// Height
		if( $args == 'staff_entry_height' ) return '450';
		if( $args == 'staff_entry_masonry_height' ) return '9999';
		
		// Crop
		if( $args == 'staff_entry_crop' ) return true;
		if( $args == 'staff_entry_masonry_crop' ) return false;
		
		
		/**
		* Staff Posts
		******************/
		
		// Width
		if( $args == 'staff_post_width' ) return '650';
		if( $args == 'staff_post_full_width' ) return '940';
		
		// Height
		if( $args == 'staff_post_height' ) return '9999';
		if( $args == 'staff_post_full_height' ) return '9999';
		
		// Crop
		if( $args == 'staff_post_crop' ) return false;
		if( $args == 'staff_post_full_crop' ) return false;
		
		
		/**
		* Testimonials
		******************/
		
		// Width
		if( $args == 'testimonial_post_width' ) return '140';
		
		// Height
		if( $args == 'testimonial_post_height' ) return '9999';
		
		// Crop
		if( $args == 'testimonial_post_crop' ) return false;


		/**
		* Services Entries
		******************/
		
		// Width
		if( $args == 'services_post_width' ) return '650';
		if( $args == 'services_post_full_width' ) return '940';
		
		// Height
		if( $args == 'services_post_height' ) return '9999';
		if( $args == 'services_post_full_height' ) return '9999';
		
		// Crop
		if( $args == 'services_post_crop' ) return false;
		if( $args == 'services_post_full_crop' ) return false;
		
		
		/**
		* Regular Pages
		******************/
		
		// Width
		if( $args == 'page_width' ) return '980';
		
		// Height
		if( $args == 'page_height' ) return '9999';
		
		// Crop
		if( $args == 'page_crop' ) return false;
		
	}
	
endif;