예제 #1
0
}
if (isset($id)) {
    $tvf = $modx->getTemplateVar($tvname, '*', $id);
    $tvv = $tvf['value'];
} else {
    $id = $modx->documentObject['id'];
    $tvf = $modx->documentObject[$tvname];
    $tvv = $tvf[1];
}
if (!$tvv || $tvv == '[]') {
    return;
}
$attachments = json_decode($tvv);
include_once MODX_BASE_PATH . 'assets/snippets/tiledphotos/tiledphotos.class.php';
$grouper = new themePacific_Jetpack_Tiled_Gallery_Grouper($attachments, $modx);
themePacific_Jetpack_Tiled_Gallery_Shape::reset_last_shape();
$rows = '';
$num = 1;
foreach ($grouper->grouped_images as $row) {
    $groups = '';
    foreach ($row->groups as $group) {
        $count = count($group->images);
        $wrap = '';
        foreach ($group->images as $image) {
            $size = 'large';
            if ($image->width < 250) {
                $size = 'small';
            }
            $image_title = $image->post_title;
            $link = $image->image_url;
            $img_src = $modx->runSnippet('phpthumb', array('input' => $link, 'options' => 'w=' . $image->width . '&h=' . $image->height . '&zc=C'));
예제 #2
0
 public function rectangular_talavera($attachments)
 {
     $grouper = new themePacific_Jetpack_Tiled_Gallery_Grouper($attachments);
     themePacific_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 = $this->vt_resize($image->ID, '', $image->width, $image->height, true);
                 $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['url']) . '" 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['url'], 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;
 }