'; $image_gallery = get_post_meta( $id, '_kad_image_gallery', true ); if(!empty($image_gallery)) { $attachments = array_filter( explode( ',', $image_gallery ) ); if ($attachments) { $i = 1; $count = count($attachments); if($count == 2) { echo '
'; if($sidebar) { $widthimgsize = 525; $heightimgsize = 350; $smallimgsize = 330; } else { $widthimgsize = 750; $heightimgsize = 500; $smallimgsize = 460; } foreach ($attachments as $attachment) { $alt = get_post_meta($attachment, '_wp_attachment_image_alt', true); if($i == 1) { $img = ascend_get_image_array($widthimgsize, $heightimgsize, true, null, $alt, $attachment, false); $padding = ($heightimgsize/$widthimgsize) * 100; } else { $img = ascend_get_image_array($smallimgsize, $smallimgsize, true, null, $alt, $attachment, false); $padding = ($smallimgsize/$smallimgsize) * 100; } if( ascend_lazy_load_filter() ) { $image_src_output = 'src="data:image/gif;base64,R0lGODdhAQABAPAAAP///wAAACwAAAAAAQABAEACAkQBADs=" data-lazy-src="'.esc_url($img['src']).'" '; } else { $image_src_output = 'src="'.esc_url($img['src']).'"'; } $datarel = 'post'; if($link == "post") { $imagelink = get_the_permalink(); } else if($link == "attachment"){ $imagelink = get_permalink($attachment); } else { $imagelink = $img['full']; $datarel = "lightbox"; } ?>
'; } else if($count == 3){ echo '
'; if($sidebar) { $widthimgsize = 525; $heightimgsize = 350; $swidthimgsize = 330; $sheightimgsize = 170; } else { $widthimgsize = 750; $heightimgsize = 500; $swidthimgsize = 460; $sheightimgsize = 230; } foreach ($attachments as $attachment) { $alt = get_post_meta($attachment, '_wp_attachment_image_alt', true); if($i == 1) { $img = ascend_get_image_array($widthimgsize, $heightimgsize, true, null, $alt, $attachment, false); $padding = ($heightimgsize/$widthimgsize) * 100; } else { $img = ascend_get_image_array($swidthimgsize, $sheightimgsize, true, null, $alt, $attachment, false); $padding = ($sheightimgsize/$swidthimgsize) * 100; } if( ascend_lazy_load_filter() ) { $image_src_output = 'src="data:image/gif;base64,R0lGODdhAQABAPAAAP///wAAACwAAAAAAQABAEACAkQBADs=" data-lazy-src="'.esc_url($img['src']).'" '; } else { $image_src_output = 'src="'.esc_url($img['src']).'"'; } $datarel = 'post'; if($link == "post") { $imagelink = get_the_permalink(); } else if($link == "attachment"){ $imagelink = get_permalink($attachment); } else { $imagelink = $img['full']; $datarel = "lightbox"; } if($i == 2 || $i == 3) { echo '
'; } ?>
'; } $i ++; if($i==5) break; } echo '
'; } else if($count == 4) { echo '
'; if($sidebar) { $largeimgsize = 440; $smallimgsize = 220; } else { $largeimgsize = 600; $smallimgsize = 300; } foreach ($attachments as $attachment) { $alt = get_post_meta($attachment, '_wp_attachment_image_alt', true); if($i == 1) { $img = ascend_get_image_array($largeimgsize, floor($largeimgsize*1.55), true, null, $alt, $attachment, false); $padding = (floor($largeimgsize*1.55)/$largeimgsize) * 100; } elseif($i == 4) { $img = ascend_get_image_array($largeimgsize, $smallimgsize, true, null, $alt, $attachment, false); $padding = ($smallimgsize/$largeimgsize) * 100; } else { $img = ascend_get_image_array($smallimgsize, $smallimgsize, true, null, $alt, $attachment, false); $padding = ($smallimgsize/$smallimgsize) * 100; } if( ascend_lazy_load_filter() ) { $image_src_output = 'src="data:image/gif;base64,R0lGODdhAQABAPAAAP///wAAACwAAAAAAQABAEACAkQBADs=" data-lazy-src="'.esc_url($img['src']).'" '; } else { $image_src_output = 'src="'.esc_url($img['src']).'"'; } $datarel = 'post'; if($link == "post") { $imagelink = get_the_permalink(); } else if($link == "attachment"){ $imagelink = get_permalink($attachment); } else { $imagelink = $img['full']; $datarel = "lightbox"; } if($i == 2 || $i == 4) { echo '
'; } ?>
'; } $i ++; if($i==5) break; } echo '
'; } else { echo '
'; if($sidebar) { $largeimgsize = 440; $smallimgsize = 220; } else { $largeimgsize = 600; $smallimgsize = 300; } foreach ($attachments as $attachment) { $alt = get_post_meta($attachment, '_wp_attachment_image_alt', true); if($i == 3) { $img = ascend_get_image_array($largeimgsize, $largeimgsize, true, null, $alt, $attachment, false); $padding = ($largeimgsize/$largeimgsize) * 100; } else if($i == 4 || $i == 5) { $img = ascend_get_image_array($largeimgsize, $smallimgsize, true, null, $alt, $attachment, false); $padding = ($smallimgsize/$largeimgsize) * 100; } else { $img = ascend_get_image_array($smallimgsize, $smallimgsize, true, null, $alt, $attachment, false); $padding = ($smallimgsize/$smallimgsize) * 100; } if( ascend_lazy_load_filter() ) { $image_src_output = 'src="data:image/gif;base64,R0lGODdhAQABAPAAAP///wAAACwAAAAAAQABAEACAkQBADs=" data-lazy-src="'.esc_url($img['src']).'" '; } else { $image_src_output = 'src="'.esc_url($img['src']).'"'; } $datarel = 'post'; if($link == "post") { $imagelink = get_the_permalink(); } else if($link == "attachment"){ $imagelink = get_permalink($attachment); } else { $imagelink = $img['full']; $datarel = "lightbox"; } if($i == 1 || $i == 4) { echo '
'; } ?>
'; } $i ++; if($i==6) break; } echo '
'; } } } echo '
'; } }