public function rectangular_talavera($attachments) { $grouper = new Jetpack_Tiled_Gallery_Grouper($attachments); Jetpack_Tiled_Gallery_Shape::reset_last_shape(); $output = $this->generate_carousel_container(); foreach ($grouper->grouped_images as $row) { $output .= '<div class="gallery-row" style="' . esc_attr('width: ' . $row->width . 'px; height: ' . ($row->height - 4) . 'px;') . '">'; foreach ($row->groups as $group) { $count = count($group->images); $output .= '<div class="gallery-group images-' . esc_attr($count) . '" style="' . esc_attr('width: ' . $group->width . 'px; height: ' . $group->height . 'px;') . '">'; foreach ($group->images as $image) { $size = 'large'; if ($image->width < 250) { $size = 'small'; } $image_title = $image->post_title; $orig_file = wp_get_attachment_url($image->ID); $link = $this->get_attachment_link($image->ID, $orig_file); $img_src = add_query_arg(array('w' => $image->width, 'h' => $image->height), $orig_file); $output .= '<div class="tiled-gallery-item tiled-gallery-item-' . esc_attr($size) . '"><a href="' . esc_url($link) . '"><img ' . $this->generate_carousel_image_args($image) . ' src="' . esc_url($img_src) . '" width="' . esc_attr($image->width) . '" height="' . esc_attr($image->height) . '" align="left" title="' . esc_attr($image_title) . '" /></a>'; if ($this->atts['grayscale'] == true) { $img_src_grayscale = jetpack_photon_url($img_src, array('filter' => 'grayscale')); $output .= '<a href="' . esc_url($link) . '"><img ' . $this->generate_carousel_image_args($image) . ' class="grayscale" src="' . esc_url($img_src_grayscale) . '" width="' . esc_attr($image->width) . '" height="' . esc_attr($image->height) . '" align="left" title="' . esc_attr($image_title) . '" /></a>'; } if (trim($image->post_excerpt)) { $output .= '<div class="tiled-gallery-caption">' . wptexturize($image->post_excerpt) . '</div>'; } $output .= '</div>'; } $output .= '</div>'; } $output .= '</div>'; } $output .= '</div>'; return $output; }
public function HTML($context = array()) { $grouper = new Jetpack_Tiled_Gallery_Grouper($this->attachments); Jetpack_Tiled_Gallery_Shape::reset_last_shape(); return parent::HTML(array('rows' => $grouper->grouped_images)); }