function shoestrap_logo()
 {
     $logo = shoestrap_getVariable('logo');
     if (!empty($logo['url'])) {
         // AC - resize the logo based on the header height
         // STANDARD LOGO
         // Use the header height to resize
         $navbar_height = filter_var(shoestrap_getVariable('navbar_height', true), FILTER_SANITIZE_NUMBER_INT);
         $args = array('current_height' => $logo['height'], 'current_width' => $logo['width'], 'new_height' => $navbar_height);
         // Get the new image dimensions
         $resized = ac_resize_image_dimensions($args);
         // Resize the logo
         $args = array("crop" => false, "height" => $navbar_height, "width" => $resized['width'], "url" => $logo['url']);
         $image = shoestrap_image_resize($args);
         $image = $image['url'];
         $logo_class = '';
         // TRANSPARENT NAV LOGO
         if (shoestrap_getVariable('navbar_fixed') == true) {
             $start_logo = shoestrap_getVariable('navbar_transparent_starting_logo');
             if ($start_logo['url']) {
                 $args = array('current_height' => $start_logo['height'], 'current_width' => $start_logo['width'], 'new_height' => $navbar_height);
                 // Get the new image dimensions
                 $resized = ac_resize_image_dimensions($args);
                 // Resize the logo
                 $args = array("crop" => false, "height" => $navbar_height, "width" => $resized['width'], "url" => $start_logo['url']);
                 $trans_image = shoestrap_image_resize($args);
                 $trans_image = $trans_image['url'];
                 // As we have a trans logo, set a class for the main logo to enable fade out
                 $logo_class = ' trans-nav-logo ';
                 echo '<img id="site-logo-start" class="site-logo" src="' . $trans_image . '" alt="' . get_bloginfo('name') . '">';
             }
         }
         // Print the logos
         echo '<img id="site-logo" class="site-logo ' . $logo_class . '" src="' . $image . '" alt="' . get_bloginfo('name') . '">';
     } else {
         echo '<span class="sitename">' . bloginfo('name') . '</span>';
     }
 }
function ac_resize_image_for_height($args)
{
    // Defaults
    $defaults = array("image_id" => null, "height" => null, "ratio" => AC_IMAGE_RATIO_3BY2, "crop" => true);
    $args = wp_parse_args($args, $defaults);
    extract($args);
    // Calc HEIGHT
    $new_width = null;
    switch ($ratio) {
        case AC_IMAGE_RATIO_3BY2:
            // 3/2
            $new_width = round($height / (3 / 2));
            break;
        case AC_IMAGE_RATIO_SQUARE:
            // square
            $new_width = $height;
            break;
        case AC_IMAGE_RATIO_PRESERVE:
            // preserve ratio
            // Calc height from new width
            // Get the original images
            $orig_image = wp_get_attachment_image_src($image_id, 'full');
            // Build args of dimensions
            $args = array('current_height' => $orig_image[2], 'current_width' => $orig_image[1], 'new_height' => $height);
            // Get the new image dimensions
            $resized = ac_resize_image_dimensions($args);
            // Store the resized dimensions
            $new_width = $resized['width'];
            $new_height = $resized['height'];
            break;
        case AC_IMAGE_RATIO_2BY1:
            // 2/1
            $new_width = round($height * (2 / 1));
            break;
        case AC_IMAGE_RATIO_1BY2:
            // 1/2
            $new_width = round($height * (1 / 2));
            break;
    }
    $url = wp_get_attachment_url($image_id);
    // Resize
    $image = shoestrap_image_resize(array('id' => $image_id, 'url' => $url, 'width' => $new_width, 'height' => $height, 'crop' => $crop));
    return $image;
}