Galeria dimatges

Primer de tot cal crear el tipus de contingut ‘Imatge per a la galeria’. Per fer-ho, aneu a ‘Estructura > Tipus de contingut > Importa’, enganxeu el següent codi a la caixa de text que us apareix i feu clic al botó ‘Importa’.

$data = array(
‘bundles’ => array(
‘gallery_image’ => (object) array(
‘type’ => ‘gallery_image’,
‘name’ => ‘Imatge per a la galeria’,
‘base’ => ‘node_content’,
‘module’ => ‘bootstrap_gallery_feature’,
‘description’ => ‘Imatges que apareixeran a l\’apartat Galeria’,
‘help’ => ‘La galeria està dissenyada per mostrar correctament imatges horitzontals. Si voleu incorporar imatges verticals, per tal que no les talli, pujeu-les amb un format 600×400 px incorporant blanc a banda i banda.’,
‘has_title’ => ‘1’,
‘title_label’ => ‘Títol’,
‘custom’ => ‘0’,
‘modified’ => ‘1’,
‘locked’ => ‘1’,
‘disabled’ => FALSE,
‘orig_type’ => ‘gallery_image’,
‘disabled_changed’ => FALSE,
‘bc_entity_type’ => ‘node’,
),
),
‘fields’ => array(
‘body’ => array(
‘entity_types’ => array(
0 => ‘node’,
),
‘indexes’ => array(
‘format’ => array(
0 => ‘format’,
),
),
‘settings’ => array(),
‘translatable’ => ‘0’,
‘foreign keys’ => array(
‘format’ => array(
‘table’ => ‘filter_format’,
‘columns’ => array(
‘format’ => ‘format’,
),
),
),
‘storage’ => array(
‘type’ => ‘field_sql_storage’,
‘settings’ => array(),
‘module’ => ‘field_sql_storage’,
‘active’ => ‘1’,
‘details’ => array(
‘sql’ => array(
‘FIELD_LOAD_CURRENT’ => array(
‘field_data_body’ => array(
‘value’ => ‘body_value’,
‘summary’ => ‘body_summary’,
‘format’ => ‘body_format’,
),
),
‘FIELD_LOAD_REVISION’ => array(
‘field_revision_body’ => array(
‘value’ => ‘body_value’,
‘summary’ => ‘body_summary’,
‘format’ => ‘body_format’,
),
),
),
),
),
‘field_name’ => ‘body’,
‘type’ => ‘text_with_summary’,
‘module’ => ‘text’,
‘active’ => ‘1’,
‘locked’ => ‘0’,
‘cardinality’ => ‘1’,
‘deleted’ => ‘0’,
‘columns’ => array(
‘value’ => array(
‘type’ => ‘text’,
‘size’ => ‘big’,
‘not null’ => FALSE,
),
‘summary’ => array(
‘type’ => ‘text’,
‘size’ => ‘big’,
‘not null’ => FALSE,
),
‘format’ => array(
‘type’ => ‘varchar’,
‘length’ => 255,
‘not null’ => FALSE,
),
),
‘bundles’ => array(
‘node’ => array(
0 => ‘page’,
1 => ‘biblio’,
2 => ‘gallery_image’,
),
),
),
‘field_gallery_image’ => array(
‘entity_types’ => array(),
‘foreign keys’ => array(
‘fid’ => array(
‘table’ => ‘file_managed’,
‘columns’ => array(
‘fid’ => ‘fid’,
),
),
),
‘indexes’ => array(
‘fid’ => array(
0 => ‘fid’,
),
),
‘settings’ => array(
‘uri_scheme’ => ‘public’,
‘default_image’ => 0,
),
‘translatable’ => ‘0’,
‘storage’ => array(
‘type’ => ‘field_sql_storage’,
‘settings’ => array(),
‘module’ => ‘field_sql_storage’,
‘active’ => ‘1’,
‘details’ => array(
‘sql’ => array(
‘FIELD_LOAD_CURRENT’ => array(
‘field_data_field_gallery_image’ => array(
‘fid’ => ‘field_gallery_image_fid’,
‘alt’ => ‘field_gallery_image_alt’,
‘title’ => ‘field_gallery_image_title’,
‘width’ => ‘field_gallery_image_width’,
‘height’ => ‘field_gallery_image_height’,
),
),
‘FIELD_LOAD_REVISION’ => array(
‘field_revision_field_gallery_image’ => array(
‘fid’ => ‘field_gallery_image_fid’,
‘alt’ => ‘field_gallery_image_alt’,
‘title’ => ‘field_gallery_image_title’,
‘width’ => ‘field_gallery_image_width’,
‘height’ => ‘field_gallery_image_height’,
),
),
),
),
),
‘field_name’ => ‘field_gallery_image’,
‘type’ => ‘image’,
‘module’ => ‘image’,
‘active’ => ‘1’,
‘locked’ => ‘0’,
‘cardinality’ => ‘1’,
‘deleted’ => ‘0’,
‘columns’ => array(
‘fid’ => array(
‘description’ => ‘The {file_managed}.fid being referenced in this field.’,
‘type’ => ‘int’,
‘not null’ => FALSE,
‘unsigned’ => TRUE,
),
‘alt’ => array(
‘description’ => ‘Alternative image text, for the image\’s \’alt\’ attribute.’,
‘type’ => ‘varchar’,
‘length’ => 512,
‘not null’ => FALSE,
),
‘title’ => array(
‘description’ => ‘Image title text, for the image\’s \’title\’ attribute.’,
‘type’ => ‘varchar’,
‘length’ => 1024,
‘not null’ => FALSE,
),
‘width’ => array(
‘description’ => ‘The width of the image in pixels.’,
‘type’ => ‘int’,
‘unsigned’ => TRUE,
),
‘height’ => array(
‘description’ => ‘The height of the image in pixels.’,
‘type’ => ‘int’,
‘unsigned’ => TRUE,
),
),
‘bundles’ => array(
‘node’ => array(
0 => ‘gallery_image’,
),
),
),
),
‘instances’ => array(
‘body’ => array(
0 => array(
‘default_value’ => NULL,
‘description’ => ”,
‘display’ => array(
‘default’ => array(
‘label’ => ‘hidden’,
‘type’ => ‘text_default’,
‘weight’ => ‘0’,
‘settings’ => array(),
‘module’ => ‘text’,
),
‘teaser’ => array(
‘label’ => ‘hidden’,
‘module’ => ‘text’,
‘settings’ => array(
‘trim_length’ => 600,
),
‘type’ => ‘text_summary_or_trimmed’,
‘weight’ => 0,
),
),
‘label’ => ‘Body’,
‘required’ => FALSE,
‘settings’ => array(
‘display_summary’ => TRUE,
‘text_processing’ => 1,
‘user_register_form’ => FALSE,
),
‘widget’ => array(
‘module’ => ‘text’,
‘settings’ => array(
‘rows’ => 20,
‘summary_rows’ => 5,
),
‘type’ => ‘text_textarea_with_summary’,
‘weight’ => 2,
),
‘field_name’ => ‘body’,
‘entity_type’ => ‘node’,
‘bundle’ => ‘gallery_image’,
‘deleted’ => ‘0’,
),
),
‘field_gallery_image’ => array(
0 => array(
‘description’ => ”,
‘display’ => array(
‘default’ => array(
‘label’ => ‘above’,
‘type’ => ‘image’,
‘weight’ => ‘1’,
‘settings’ => array(
‘image_style’ => ‘galeria’,
‘image_link’ => ”,
),
‘module’ => ‘image’,
),
‘teaser’ => array(
‘label’ => ‘above’,
‘settings’ => array(),
‘type’ => ‘hidden’,
‘weight’ => 0,
),
),
‘label’ => ‘Imatge’,
‘required’ => 1,
‘settings’ => array(
‘file_directory’ => ”,
‘file_extensions’ => ‘png gif jpg jpeg’,
‘max_filesize’ => ”,
‘max_resolution’ => ”,
‘min_resolution’ => ”,
‘alt_field’ => 1,
‘title_field’ => 1,
‘default_image’ => 0,
‘user_register_form’ => FALSE,
),
‘widget’ => array(
‘weight’ => 1,
‘type’ => ‘image_image’,
‘module’ => ‘image’,
‘active’ => 1,
‘settings’ => array(
‘progress_indicator’ => ‘throbber’,
‘preview_image_style’ => ‘thumbnail’,
‘insert’ => 0,
‘insert_absolute’ => 0,
‘insert_styles’ => array(
‘auto’ => ‘auto’,
‘link’ => 0,
‘icon_link’ => 0,
‘image’ => 0,
‘image_capcalera’ => 0,
‘colorbox__capcalera’ => 0,
‘colorbox__destacats_320x120’ => 0,
‘colorbox__destacats_320x240’ => 0,
‘colorbox__fotografia_personal’ => 0,
‘colorbox__fotografia_personal_mitjana’ => 0,
‘colorbox__galeria’ => 0,
‘colorbox__large’ => 0,
‘colorbox__medium’ => 0,
‘colorbox__square_thumbnail’ => 0,
‘colorbox__thumbnail’ => 0,
‘image_destacats_320x120’ => 0,
‘image_destacats_320x240’ => 0,
‘image_fotografia_personal’ => 0,
‘image_fotografia_personal_mitjana’ => 0,
‘image_galeria’ => 0,
‘image_large’ => 0,
‘image_medium’ => 0,
‘image_square_thumbnail’ => 0,
‘image_thumbnail’ => 0,
),
‘insert_default’ => ‘auto’,
‘insert_class’ => ”,
‘insert_width’ => ”,
),
),
‘field_name’ => ‘field_gallery_image’,
‘entity_type’ => ‘node’,
‘bundle’ => ‘gallery_image’,
‘deleted’ => ‘0’,
),
),
),
);

Amb això ja podeu crear contingut per a la vostra galeria d’imatges, però encara no es mostraran com una galeria. Per fer-ho, heu d’importar una vista. Aneu a ‘Estructura > Views > Importa’, enganxeu el següent codi a la caixa de text etiquetada com ‘Paste view code here’ i premeu ‘Importa’.

$view = new view();
$view->name = ‘bootstrap_gallery’;
$view->description = ”;
$view->tag = ‘default’;
$view->base_table = ‘node’;
$view->human_name = ‘Galeria d\’imatges’;
$view->core = 7;
$view->api_version = ‘3.0’;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially *//* Display: Master */
$handler = $view->new_display(‘default’, ‘Master’, ‘default’);
$handler->display->display_options[‘title’] = ‘Galeria d\’imatges’;
$handler->display->display_options[‘use_more_always’] = FALSE;
$handler->display->display_options[‘use_more_text’] = ‘més’;
$handler->display->display_options[‘access’][‘type’] = ‘perm’;
$handler->display->display_options[‘cache’][‘type’] = ‘none’;
$handler->display->display_options[‘query’][‘type’] = ‘views_query’;
$handler->display->display_options[‘exposed_form’][‘type’] = ‘basic’;
$handler->display->display_options[‘exposed_form’][‘options’][‘submit_button’] = ‘Aplica’;
$handler->display->display_options[‘exposed_form’][‘options’][‘reset_button_label’] = ‘Reinicialitza’;
$handler->display->display_options[‘exposed_form’][‘options’][‘exposed_sorts_label’] = ‘Ordena per’;
$handler->display->display_options[‘pager’][‘type’] = ‘full’;
$handler->display->display_options[‘pager’][‘options’][‘items_per_page’] = ’10’;
$handler->display->display_options[‘pager’][‘options’][‘expose’][‘items_per_page_label’] = ‘Elements per pàgina’;
$handler->display->display_options[‘pager’][‘options’][‘expose’][‘items_per_page_options_all_label’] = ‘- Tot -‘;
$handler->display->display_options[‘pager’][‘options’][‘expose’][‘offset_label’] = ‘Desplaçament’;
$handler->display->display_options[‘pager’][‘options’][‘tags’][‘first’] = ‘« primer’;
$handler->display->display_options[‘pager’][‘options’][‘tags’][‘previous’] = ‘‹ anterior’;
$handler->display->display_options[‘pager’][‘options’][‘tags’][‘next’] = ‘següent ›’;
$handler->display->display_options[‘pager’][‘options’][‘tags’][‘last’] = ‘últim »’;
$handler->display->display_options[‘style_plugin’] = ‘bootstrap_gallery’;
$handler->display->display_options[‘row_plugin’] = ‘fields’;
/* Camp: Global: Conjunt de camps */
$handler->display->display_options[‘fields’][‘fieldset’][‘id’] = ‘fieldset’;
$handler->display->display_options[‘fields’][‘fieldset’][‘table’] = ‘views’;
$handler->display->display_options[‘fields’][‘fieldset’][‘field’] = ‘fieldset’;
$handler->display->display_options[‘fields’][‘fieldset’][‘label’] = ‘Imatge-galeria’;
$handler->display->display_options[‘fields’][‘fieldset’][‘alter’][‘alter_text’] = TRUE;
$handler->display->display_options[‘fields’][‘fieldset’][‘hide_empty’] = TRUE;
$handler->display->display_options[‘fields’][‘fieldset’][‘children’] = array(
0 => ‘field_gallery_image’,
1 => ‘title’,
);
$handler->display->display_options[‘fields’][‘fieldset’][‘fieldset’][‘type’] = ‘div’;
$handler->display->display_options[‘fields’][‘fieldset’][‘fieldset’][‘classes’] = ‘imatge-bootstrap-gallery’;
/* Camp: Contingut: Imatge */
$handler->display->display_options[‘fields’][‘field_gallery_image’][‘id’] = ‘field_gallery_image’;
$handler->display->display_options[‘fields’][‘field_gallery_image’][‘table’] = ‘field_data_field_gallery_image’;
$handler->display->display_options[‘fields’][‘field_gallery_image’][‘field’] = ‘field_gallery_image’;
$handler->display->display_options[‘fields’][‘field_gallery_image’][‘label’] = ”;
$handler->display->display_options[‘fields’][‘field_gallery_image’][‘element_class’] = ‘img-bootstrap-galeria’;
$handler->display->display_options[‘fields’][‘field_gallery_image’][‘element_label_colon’] = FALSE;
$handler->display->display_options[‘fields’][‘field_gallery_image’][‘element_default_classes’] = FALSE;
$handler->display->display_options[‘fields’][‘field_gallery_image’][‘click_sort_column’] = ‘fid’;
$handler->display->display_options[‘fields’][‘field_gallery_image’][‘settings’] = array(
‘image_style’ => ‘galeria’,
‘image_link’ => ”,
);
/* Camp: Contingut: Títol */
$handler->display->display_options[‘fields’][‘title’][‘id’] = ‘title’;
$handler->display->display_options[‘fields’][‘title’][‘table’] = ‘node’;
$handler->display->display_options[‘fields’][‘title’][‘field’] = ‘title’;
$handler->display->display_options[‘fields’][‘title’][‘label’] = ”;
$handler->display->display_options[‘fields’][‘title’][‘alter’][‘word_boundary’] = FALSE;
$handler->display->display_options[‘fields’][‘title’][‘alter’][‘ellipsis’] = FALSE;
$handler->display->display_options[‘fields’][‘title’][‘element_type’] = ‘h3’;
$handler->display->display_options[‘fields’][‘title’][‘element_class’] = ‘sr-only’;
$handler->display->display_options[‘fields’][‘title’][‘element_label_colon’] = FALSE;
$handler->display->display_options[‘fields’][‘title’][‘element_default_classes’] = FALSE;
$handler->display->display_options[‘fields’][‘title’][‘link_to_node’] = FALSE;
/* Sort criterion: Contingut: Data de publicació */
$handler->display->display_options[‘sorts’][‘created’][‘id’] = ‘created’;
$handler->display->display_options[‘sorts’][‘created’][‘table’] = ‘node’;
$handler->display->display_options[‘sorts’][‘created’][‘field’] = ‘created’;
$handler->display->display_options[‘sorts’][‘created’][‘order’] = ‘DESC’;
/* Filter criterion: Contingut: Publicat */
$handler->display->display_options[‘filters’][‘status’][‘id’] = ‘status’;
$handler->display->display_options[‘filters’][‘status’][‘table’] = ‘node’;
$handler->display->display_options[‘filters’][‘status’][‘field’] = ‘status’;
$handler->display->display_options[‘filters’][‘status’][‘value’] = 1;
$handler->display->display_options[‘filters’][‘status’][‘group’] = 1;
$handler->display->display_options[‘filters’][‘status’][‘expose’][‘operator’] = FALSE;
/* Filter criterion: Contingut: Tipus */
$handler->display->display_options[‘filters’][‘type’][‘id’] = ‘type’;
$handler->display->display_options[‘filters’][‘type’][‘table’] = ‘node’;
$handler->display->display_options[‘filters’][‘type’][‘field’] = ‘type’;
$handler->display->display_options[‘filters’][‘type’][‘value’] = array(
‘gallery_image’ => ‘gallery_image’,
);
/* Filter criterion: Contingut: Llengua */
$handler->display->display_options[‘filters’][‘language’][‘id’] = ‘language’;
$handler->display->display_options[‘filters’][‘language’][‘table’] = ‘node’;
$handler->display->display_options[‘filters’][‘language’][‘field’] = ‘language’;
$handler->display->display_options[‘filters’][‘language’][‘value’] = array(
‘***CURRENT_LANGUAGE***’ => ‘***CURRENT_LANGUAGE***’,
);/* Display: Galeria l’imatges */
$handler = $view->new_display(‘page’, ‘Galeria l\’imatges’, ‘page’);
$handler->display->display_options[‘path’] = ‘galeria-imatges’;
$handler->display->display_options[‘menu’][‘title’] = ‘Galeria d\’imatges’;
$handler->display->display_options[‘menu’][‘weight’] = ‘0’;
$handler->display->display_options[‘menu’][‘name’] = ‘main-menu’;
$handler->display->display_options[‘menu’][‘context’] = 0;
$handler->display->display_options[‘menu’][‘context_only_inline’] = 0;
$translatables[‘bootstrap_gallery’] = array(
t(‘Master’),
t(‘Galeria d\’imatges’),
t(‘més’),
t(‘Aplica’),
t(‘Reinicialitza’),
t(‘Ordena per’),
t(‘Asc’),
t(‘Desc’),
t(‘Elements per pàgina’),
t(‘- Tot -‘),
t(‘Desplaçament’),
t(‘« primer’),
t(‘‹ anterior’),
t(‘següent ›’),
t(‘últim »’),
t(‘Imatge-galeria’),
t(‘Galeria l\’imatges’),
);

Per dotar de contingut aquesta secció aneu a ‘Contingut > Afegeix contingut > Imatge per a la galeria’.

La galeria està dissenyada per mostrar correctament imatges horitzontals. Si voleu incorporar imatges verticals, per tal que no les talli, pujeu-les amb un format 600×400 px incorporant blanc a banda i banda.