1
|
<p>In this example you will create a views block that displays images in a slideshow using thumbnails of the images as a pager underneath the slideshow. This will demonstrate using <em>Views Slideshow </em>and <em>Image Styles</em> to display images.</p>
|
2
|
|
3
|
<p>For this example, we are going to display a single image from each content item of the type "Photos", which we assume you have already set up with an image field. We are also assuming that <em>Views Slideshow</em> and at least one plugin is installed and activated.</p>
|
4
|
|
5
|
<h3>Creating the image styles</h3>
|
6
|
|
7
|
<p>The first step is creating the right image styles to display the images from the node. We will create one for the slideshow image, and one for the pagers. Go to <a target="_blank" href="base_url:admin/structure/views/add">Image Styles</a> and create the following two styles:</p>
|
8
|
|
9
|
<dl>
|
10
|
<dt>Style name</dt>
|
11
|
<dd>slideshow_image</dd>
|
12
|
<dt>Effects</dt>
|
13
|
<dd>Scale and crop: 600px wide, 400px high</dd>
|
14
|
</dl>
|
15
|
<dl>
|
16
|
<dt>Style name</dt>
|
17
|
<dd>slideshow_thumbnail</dd>
|
18
|
<dt>Effects</dt>
|
19
|
<dd>Scale and crop: 30px wide, 20px high</dd>
|
20
|
</dl>
|
21
|
|
22
|
<h3>Creating the View and block</h3>
|
23
|
|
24
|
<p>The next step is creating a view for the slideshow. Because the block will show the images in content, this view is considered a "Content" view. Go to <a target="_blank" href="base_url:admin/structure/views/add">add new view</a>, enter the following properties, and click <strong>Next</strong>:</p>
|
25
|
<dl>
|
26
|
<dt>View name</dt>
|
27
|
<dd>Photo Slideshow</dd>
|
28
|
<dt>Description</dt>
|
29
|
<dd>Slideshow of images from Photos.</dd>
|
30
|
</dl>
|
31
|
|
32
|
<p>Choose <strong>Show</strong> <em>Content</em> <strong>of type</strong> <em>Photos</em>. You can choose any way you wish to sort the content.</p>
|
33
|
<p>Untick the box next to <strong>Create a page</strong> and tick the box next to <strong>Create a block</strong>. Enter a block title and choose Slideshow from the <strong>Display format</strong> select box. Select <em>fields</em> from the other select box. Leave the remaining settings as they are.</p>
|
34
|
<p>Click on <strong>Continue & edit</strong>.</p>
|
35
|
|
36
|
<h3>Editing the view settings</h3>
|
37
|
|
38
|
<p>Turn off the pager by clicking on <strong>Display a specified number of items</strong> in the middle column and selecting <strong>Display all items</strong> in the next screen, and applying the settings.</p>
|
39
|
<p>Enter a Block name by clicking on <strong>None</strong> at the top of the middle column.</p>
|
40
|
<p>Next, remove the <em>Content: Title</em> field from the fields list in the left column by blicking on <strong>rearrage</strong> under the arrow.</p>
|
41
|
<p>Next we have to add the thumbnail image field. Click on <strong>Add</strong> under the fields section and select your image field from the list. In the next screen, turn off the label, select <em>Exclude from display</em> and select <em>slideshow_thumbnail</em> from the Image Style select box. Under MORE, enter <em>Thumbnail</em> under Administrative Title.</p>
|
42
|
<p>Click on <strong>Apply (all displays)</strong>.</p>
|
43
|
<p>Now we have to add the image field to display in the slideshow. Clcik on <strong>Add</strong> under the fields section and select your image field from the list. In the next screen, turn off the label and select <em>slideshow_image</em> from the Image Style select box. Under MORE, enter <em>Display Image</em> under Administrative Title.</p>
|
44
|
<p>Click on <strong>Apply (all displays)</strong>.</p>
|
45
|
|
46
|
<h3>Editing the slideshow settings</h3>
|
47
|
|
48
|
<p>Click on <strong>Settings</strong> next to Format: Slideshow in the first column. In the screen that opens we can choose the options for our slideshow.</p>
|
49
|
<p>For the purpose of this example, we will only add the thumbnails as a pager, and leave the remaining slideshow settings as they are. Select the tick box next to <em>Pager</em> under Bottom Widgets. Select <em>Fields</em> from the Pager Type select box. Select the tick box next to <em>Thumbnail</em>.</p>
|
50
|
<p>Click on <strong>Apply (all displays)</strong>.</p>
|
51
|
|
52
|
<h3>Saving & testing the view</h3>
|
53
|
<p>Click on <strong>Save</strong> to save the view.</p>
|
54
|
<p>You can test the view by adding the block you have created to your theme.</p>
|