Hi folks,

I see on your demo here: http://kharbat.me/article/introducing-bootstrap-photo-gallery-drupal-module

... that there is an image style attached to the full image.

I wonder if anyone can shed any light onhow I would also do this?

Any ideas would be much appreciated and I could have a crack at implementing.

Regards,
James

Comments

JamesMugford’s picture

Was able to do this by pasting this in to template.php:

function coa_z_preprocess_views_view_field(&$vars){
    if($vars['view']->plugin_name == 'bootstrap_gallery') {
        $view = $vars['view'];
        $field = $vars['field'];
        $field_name = $field->field;

        $options = bootstrap_gallery_get_options($view->style_plugin->options);
        $plugin_image_field = $options['image_field'];
        $plugin_image_title = $options['image_title'];

        if($field_name == $plugin_image_field) {
            $row = (array)$vars['row'];

            if(isset($row["field_{$field_name}"]) && $image = $row["field_{$field_name}"]){
                $original_image = image_style_url('full_width_tab', $image[0]['raw']['uri']);
                $thumbnail = $vars['field']->advanced_render($vars['row']);
                $title = $image[0]['raw']['title'];



                if($plugin_image_title != 'default') {
                    if(isset($view->field[$plugin_image_title])
                        && $title_field = $view->field[$plugin_image_title]) {
                        $field_object = $title_field->get_value($vars['row']);

                        if(is_string($field_object)) {
                            $title = $field_object;
                        } else if(is_array($field_object) && isset($field_object[0]['value'])) {
                            $title = $field_object[0]['value'];
                        } else {
                            drupal_set_message(t('Bootstrap Gallery: Selected image title field type is not supported', 'warning'));
                        }
                    }
                }

                $vars['output'] = theme('bootstrap_gallery_item', array(
                    'original_image' => $original_image,
                    'thumbnail' => $thumbnail,
                    'title' => $title,
                ));
            }

        }
    }
}

Note: modify the string: "full_width_tab" to the machine name of your image style.

(this may need stripping down, however that is done?)

kharbat’s picture

Status: Active » Fixed

Thanks! You can use image styles in the Views Plugin settings now

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.