public function __construct($attachments, $width)
 {
     $content_width = PHTPB_Tiled_Gallery::get_content_width($width);
     $this->last_shape = '';
     $this->images = $this->get_images_with_sizes($attachments);
     $this->grouped_images = $this->get_grouped_images();
     $this->apply_content_width($content_width);
 }
 protected function phtpb_gallery_portfolio()
 {
     if (!$this->phtpb_type) {
         return;
     }
     $query_args = array('post_type' => $this->phtpb_type, 'meta_key' => '_thumbnail_id', 'ignore_sticky_posts' => 1);
     if ($this->count) {
         $query_args['posts_per_page'] = $this->count;
     }
     $phtpb_query = isset($this->atts['phtpb_query']) ? htmlspecialchars_decode($this->atts['phtpb_query']) : '';
     $query_args_with_phtpb_query = wp_parse_args($phtpb_query, $query_args);
     $query_args_with_phtpb_query = $this->remove_unallowed_query_args($query_args_with_phtpb_query);
     $query_args_with_phtpb_query['paged'] = is_front_page() ? get_query_var('page') : get_query_var('paged');
     ob_start();
     $custom_query = new WP_Query($query_args_with_phtpb_query);
     if ($custom_query->have_posts()) {
         $post_ids = array();
         while ($custom_query->have_posts()) {
             $custom_query->the_post();
             $post_ids[] = get_the_id();
         }
         $tiled_gallery = new PHTPB_Tiled_Gallery();
         echo $tiled_gallery->rectangular_talavera_of_posts($post_ids, $this->phtpb_width, false, $this->lightbox);
     }
     wp_reset_postdata();
     $posts = ob_get_contents();
     ob_end_clean();
     $output = $posts;
     $css = $this->herited_color ? 'color:' . $this->herited_color : '';
     return $this->container($output, 'phtpb_item pht-gallery pht-gallery--' . $this->select_attribute('border_width'), $css);
 }