function max_get_timthumb_image($return = false, $p_id = false, $img_size = 'full') { global $post, $imgDimensions, $imgDimensions1x, $p_tpl, $resize_images, $is_retina; $max_mobile_detect = new Mobile_Detect(); // get the sting we need for the different devices $size = $img_size; // set the attachment image size $post_id = !$p_id ? $post->ID : $p_id; // check if its a lightbox or a project page link $photo_item_type = get_post_meta($post_id, MAX_SHORTNAME . '_photo_item_type_value', true); // get the item type $imgUrl = max_get_post_image_url($post_id, $size); // Get the post image url $tpl_show_lightbox = get_post_meta(get_query_var('page_id'), MAX_SHORTNAME . '_disable_post_lightbox', true); // check to show the lightbox on this page template $use_timthumb = get_option_max('image_use_timthumb'); $pretty_rel = get_option_max('pretty_enable_lightbox', 'false') == 'false' ? ' data-rel="prettyPhoto"' : ''; $pretty_rel_gal = get_option_max('pretty_enable_lightbox', 'false') == 'false' ? ' data-rel="prettyPhoto[gal]"' : ''; // calculate the image dimensions if ($max_mobile_detect->isMobile() && !$max_mobile_detect->isTablet() && !empty($imgDimensions1x) && is_array($imgDimensions1x)) { // its a mobile phone device so we need other images to display properly $_dimensions = max_calculate_image($imgDimensions1x, $imgUrl); } else { $_dimensions = max_calculate_image($imgDimensions, $imgUrl); // desktop images are larger } // Build the image link if (has_post_thumbnail($post_id)) { // Get Image URL $imgSrc = max_get_image_path($post_id); $imgFull = max_get_post_image_url($post_id); // get the title $title = !get_the_excerpt() ? '' : ' title="' . strip_tags(htmlspecialchars(get_the_excerpt())) . '"'; $alt = ' alt="' . strip_tags(get_the_title()) . '"'; $cat_list = array(); foreach (get_the_category() as $category) { $cat_list[] = $category->cat_ID; } $output = ""; // check if we have to show a link or links are disabled if ($photo_item_type != "Disable Link" && $photo_item_type != 'disable_link') { // check if option to show lightbox on this page template is enabled if (empty($tpl_show_lightbox) || $tpl_show_lightbox == 'false') { if ($photo_item_type == "Lightbox" || $photo_item_type == 'lightbox' || $p_tpl == "template-lightbox.php" || get_option_max('image_always_lightbox') == 'true') { $lightbox_type = get_post_meta($post_id, MAX_SHORTNAME . '_photo_lightbox_type_value', true); $lightbox_link = get_post_meta($post_id, MAX_SHORTNAME . '_photo_item_custom_lightbox', true); if ($p_tpl == "template-lightbox.php") { // check for youtube or vimeo id if ($photo_item_type == 'youtube_embed') { $output .= '<a href="http://www.youtube.com/watch?v=' . get_post_meta($post_id, MAX_SHORTNAME . '_video_embeded_url_value', true) . '"' . $pretty_rel_gal . ' data-link="' . get_permalink($post_id) . '"' . $title . '>'; } else { if ($photo_item_type == 'vimeo_embed') { $output .= '<a href="http://www.vimeo.com/' . get_post_meta($post_id, MAX_SHORTNAME . '_video_embeded_url_value', true) . '"' . $pretty_rel_gal . ' data-link="' . get_permalink($post_id) . '"' . $title . '>'; } else { if ($photo_item_type == 'selfhosted_embed' || $photo_item_type == 'selfhosted') { $output .= '<a href="' . get_post_meta($post_id, MAX_SHORTNAME . '_video_url_m4v_value', true) . '?iframe=true" ' . $pretty_rel_gal . ' data-link="' . get_permalink($post_id) . '"' . $title . '>'; // check for lightbox videos } else { if ($photo_item_type == 'lightbox' && $lightbox_type == 'vimeo') { $output .= '<a href="' . get_post_meta($post_id, MAX_SHORTNAME . '_photo_video_vimeo_value', true) . '"' . $pretty_rel . $title . ' data-link="' . get_permalink($post_id) . '">'; } else { if ($photo_item_type == 'lightbox' && $lightbox_type == 'youtube') { $output .= '<a href="' . get_post_meta($post_id, MAX_SHORTNAME . '_photo_video_youtube_value', true) . '"' . $pretty_rel . $title . ' data-link="' . get_permalink($post_id) . '">'; // by default get the featured image } else { $output .= '<a href="' . $imgFull[0] . '"' . $pretty_rel_gal . ' data-link="' . get_permalink($post_id) . '"' . $title . '>'; } } } } } } else { // Display Lightbox custom link if (!empty($lightbox_link) && $lightbox_type == 'custom') { $output .= '<a href="' . $lightbox_link . '?iframe=true&width=800&height=600" ' . $pretty_rel . ' data-link="' . get_permalink($post_id) . '"' . $title . '>'; } // Display Lightbox Photo if ($lightbox_type == "Photo" || $lightbox_type == "photo") { $output .= '<a href="' . $imgFull[0] . '"' . $pretty_rel_gal . ' data-link="' . get_permalink($post_id) . '"' . $title . '>'; } // Display Lightbox YouTube Video if ($lightbox_type == "YouTube-Video" || $lightbox_type == "youtube") { $output .= '<a href="' . get_post_meta($post_id, MAX_SHORTNAME . '_photo_video_youtube_value', true) . '"' . $pretty_rel . $title . ' data-link="' . get_permalink($post_id) . '">'; } // Display Lightbox Vimeo Video if ($lightbox_type == "Vimeo-Video" || $lightbox_type == "vimeo") { $output .= '<a href="' . get_post_meta($post_id, MAX_SHORTNAME . '_photo_video_vimeo_value', true) . '"' . $pretty_rel . $title . ' data-link="' . get_permalink($post_id) . '">'; } } } else { if ($photo_item_type == "Project Page" || $photo_item_type == 'projectpage' || $photo_item_type == 'selfhosted_embed' || $photo_item_type == 'selfhosted' || $photo_item_type == 'youtube_embed' || $photo_item_type == 'vimeo_embed') { // Photo Type is a Project Page $output .= '<a href="' . get_permalink($post_id) . '"' . $title . '>'; } else { if ($photo_item_type == "External Link" || $photo_item_type == 'external') { $target = get_post_meta($post_id, MAX_SHORTNAME . '_external_link_target_value', true); $str_target = isset($target) && $target != "" ? $target : "_blank"; // Photo Type is an external Link $output .= '<a href="' . get_post_meta($post_id, MAX_SHORTNAME . '_photo_external_link_value', true) . '" target="' . get_post_meta($post_id, MAX_SHORTNAME . '_external_link_target_value', true) . '"' . $title . '">'; } else { // Get the image link $output .= '<a href="' . $imgFull[0] . '"' . $pretty_rel . $title . ' data-link="' . get_permalink($post_id) . '">'; } } } } } // fallback to lightbox if something is wrong to not break the image link } else { if (empty($tpl_show_lightbox) || $tpl_show_lightbox == 'false') { // check if option to show lightbox on this page template is enabled // Get the image link $output .= '<a href="' . $imgFull[0] . '"' . $pretty_rel . $title . ' data-link="' . get_permalink($post_id) . '">'; } } // get the new image width calculation if no height or width is set if ($_dimensions['height'] == 0) { $_dimensions['height'] = ""; } if ($_dimensions['width'] == 0) { $_dimensions['width'] = ""; } // resize the image if needed otherwise get the cropped WP version if ($resize_images === true) { // change to retina image size if (!empty($is_retina) && true === $is_retina) { $_dimensions['height'] = $_dimensions['height'] * 2; $_dimensions['width'] = $_dimensions['width'] * 2; } $data1x_img = max_get_custom_image_url(get_post_thumbnail_id($post_id), false, $_dimensions['width'], $_dimensions['height'], get_cropping_direction(get_post_meta($post_id, MAX_SHORTNAME . '_photo_cropping_direction_value', true)), false, true); } else { // lets get the cropped WP version // retina size array $size_array = array('mobile' => 'large', 'large' => 'full', 'tablet' => 'full', 'full' => 'full'); // change to retina image size if (!empty($is_retina) && true === $is_retina) { $size = $size_array[$size]; } $_wp_image = max_get_post_image_url($post_id, $size); $data1x_img = $_wp_image[0]; } // get the image tag, it's always the same $output .= '<img src="' . $data1x_img . '" ' . $alt . ' data-src="' . $data1x_img . '" class="the-post-image" />'; // Close Link if its not a disabled link if ($photo_item_type != "Disable Link" && $photo_item_type != 'disable_link') { if (empty($tpl_show_lightbox) || $tpl_show_lightbox == 'false') { // check if option to show lightbox on this page template is enabled $output .= '</a>'; } } if ($return === true) { return $output; } else { echo $output; } }
if (!empty($fullsize_gallery_posts)) { if ($fullsize_gallery_posts->have_posts()) { while ($fullsize_gallery_posts->have_posts()) { $fullsize_gallery_posts->the_post(); // check if password protected posts should be shown $show_protected_post = true; if (post_password_required()) { if (get_option_max('fullsize_exclude_protected') == 'false') { $show_protected_post = false; } } if ($show_protected_post) { //Get the page meta informations and store them in an array $_post_meta = max_get_cutom_meta_array(get_the_ID()); // get background image wether it is a desktop or a mobile $imgUrl_temp = max_get_post_image_url(get_the_ID(), $_img_string); $imgUrl_big = $imgUrl_temp[0]; $photo_link = '#'; $photo_target = ''; $show_title_link = get_option_max('fullsize_remove_title_link'); if (empty($show_title_link) || 'false' == $show_title_link) { // Check the link value for the post if (!empty($_post_meta[MAX_SHORTNAME . '_photo_item_type_value']) && str_replace(" ", "_", strtolower($_post_meta[MAX_SHORTNAME . '_photo_item_type_value'])) == 'external') { $photo_link = $_post_meta[MAX_SHORTNAME . '_photo_external_link_value']; $photo_target = $_post_meta[MAX_SHORTNAME . '_external_link_target_value']; } else { // check if a link should be shown on a fullsize_thumb_center image title if (empty($_post_meta[MAX_SHORTNAME . '_photo_item_fsg_link']) || 'true' == $_post_meta[MAX_SHORTNAME . '_photo_item_fsg_link']) { if (!empty($_post_meta[MAX_SHORTNAME . '_photo_item_custom_link']) && '' != $_post_meta[MAX_SHORTNAME . '_photo_item_custom_link']) { // Photo link is a custom link $photo_link = $_post_meta[MAX_SHORTNAME . '_photo_item_custom_link'];
if ($show_page_fullsize == 'true' && !$isPost) { if ($_background_type == 'slideshow' && $random_post && !is_category() && !is_tax() && !is_archive() && !is_404() && !is_tag() && !is_search()) { $random_post = max_query_term_posts(-1, $_gallery_array, 'gallery', 'rand'); if (have_posts()) { while (have_posts()) { the_post(); // Random image from featured homepage gallery $imgUrl_temp = max_get_post_image_url(get_the_ID(), "full"); $imgUrl = $imgUrl_temp[0]; echo '<a class="item" href="' . $imgUrl . '"></a>'; } } } else { if ($imageURL == "") { // Random image from featured homepage gallery $imgUrl_temp = max_get_post_image_url($random_post[0]->ID, "full"); $imgUrl = $imgUrl_temp[0]; } else { // show image from entered URL $imgUrl = $imageURL; } } } wp_reset_query(); /** Its an archive page **/ if (is_archive()) { $imgUrl = get_option_max('page_background_archive'); } /** Its a 404 page **/ if (is_404()) { $imgUrl = get_option_max('page_background_404');
<?php /*-----------------------------------------------------------------------------------*/ /* Get the needed Slider Template if a slider is selected /*-----------------------------------------------------------------------------------*/ if (isset($meta[MAX_SHORTNAME . '_photo_slider_select']) && $meta[MAX_SHORTNAME . '_photo_slider_select'] != "" && $meta[MAX_SHORTNAME . '_photo_slider_select'] != "none" && $meta[MAX_SHORTNAME . '_photo_item_type_value'] == 'projectpage') { // strip of "slider-" $slider_tpl = explode("-", $meta[MAX_SHORTNAME . '_photo_slider_select']); get_template_part('includes/slider', $slider_tpl[1] . '.inc'); } else { if ($meta[MAX_SHORTNAME . '_photo_item_type_value'] == 'selfhosted' || $meta[MAX_SHORTNAME . '_photo_item_type_value'] == 'youtube_embed' || $meta[MAX_SHORTNAME . '_photo_item_type_value'] == "vimeo_embed") { get_template_part('includes/post', 'video.inc'); } else { // start featured image code here if (function_exists('has_post_thumbnail') && has_post_thumbnail()) { // Get the thumbnail $post_image_url = max_get_post_image_url($post_id, 'full'); $showUrl = $post_image_url[0]; // Check if images should be cropped $timb_height = ''; $timb_img_height = ''; if (get_option_max('image_project_original_ratio') != 'true') { $timb_height = 270; $timb_img_height = 'height="270"'; // get the imgUrl for showing the post image $imgUrl = max_get_custom_image_url(get_post_thumbnail_ID(), get_the_ID(), MAX_CONTENT_WIDTH, $timb_height, get_cropping_direction($meta[MAX_SHORTNAME . '_photo_cropping_direction_value'])); } else { // get the default image if we don't have to crop $imgUrl = max_get_image_path(get_the_ID(), 'large'); } ?>