function laborator_show_img($url, $width = 0, $height = 0, $crop = FALSE) { $img_path = laborator_img($url, $width, $height, $crop); if ($img_path) { return '<img src="' . $img_path . '" ' . (is_string($width) ? ' alt="' . $width . '"' : '') . ' />'; } }
<!-- end: album details --> </div> <!-- end: showing image & album info --> <!-- gallery items --> <div class="gallery_items" id="an_gallery"> <?php # Browse Images foreach ($gallery_images as $gallery_image) { $attachment_id = $gallery_image->ID; $large_image = $gallery_image->guid; $small_image = laborator_show_img($large_image, 'gallery-list-thumb'); $medium_image = laborator_img($large_image, 'gallery-big-img'); ?> <!-- image entry --> <a href="<?php echo $medium_image; ?> " data-large="<?php echo $large_image; ?> " class="gallery_item"> <?php echo $small_image; ?> </a> <!-- end: image entry --> <?php
case 3: $thumbnail_size = 'portfolio-thumb-3'; #$post_thumbnail = get_the_post_thumbnail($post_id, $thumbnail_size, "portfolio-item-{$post_id}"); $post_thumbnail = laborator_img($post_id, $thumbnail_size); break; default: $thumbnail_size = 'portfolio-thumb-1'; #$post_thumbnail = get_the_post_thumbnail($post_id, $thumbnail_size, "portfolio-item-{$post_id}"); $post_thumbnail = laborator_img($post_id, $thumbnail_size); } # [Alternative] If there is no post thumnail attached, check for other attachments inside the post if (!$post_thumbnail) { $other_attachment = reset(get_children(array('post_parent' => $post_id, 'post_type' => 'attachment', 'posts_per_page' => 1, 'orderby' => 'menu_order', 'order' => 'ASC'))); #$post_thumbnail = wp_get_attachment_image($other_attachment->ID, $thumbnail_size); #$post_thumbnail = preg_replace('/width=.[0-9]+.|height=.[0-9]+./', '', $post_thumbnail); $post_thumbnail = laborator_img($other_attachment->ID, $thumbnail_size); } # Wrap $post_thumbnail into Image Tag if ($post_thumbnail) { $post_thumbnail = '<img src="' . $post_thumbnail . '" alt="' . $thumbnail_size . '">'; } # Category Slugs $cslugs = array(); $cnames = array(); if (!is_array($post_categories)) { $post_categories = array(); } foreach ($post_categories as $cat_term) { array_push($cslugs, $cat_term->slug); array_push($cnames, $cat_term->name); }
the_post(); ?> <!-- blog post entry --> <div <?php post_class('blog_post single'); ?> > <!-- post image --> <?php $has_thumb = false; if (has_post_thumbnail($post_id) && $show_post_thumbnails) { $has_thumb = true; # Use for videos $alt_text = get_post_meta(get_post_thumbnail_id($post_id), '_wp_attachment_image_alt', TRUE); $large_image = laborator_img($post_id, 'post-image'); # Default: Image link $href = $large_image; $rel = 'shadowbox'; # Detect Video Link if ($alt_text_video_link = get_video_frames_links($alt_text)) { $href = $alt_text_video_link; $rel .= ';width=700;height=450'; } ?> <!-- post image --> <a href="<?php echo $href; ?> " class="image hover" rel="<?php echo $rel;