[转]How to Create a Thumbnail Picture Library View in SharePoint 2007
原文地址:http://hi.baidu.com/seapub/blog/item/967125875dbddc2dc75cc31c.html
During a ten minute break at a recent SharePoint customization class, Brett Lonsdale shared how I might display images in a datasheet thumbnail view. Thanks Brett! With his knowledge and my curiosity, I took my hurriedly scribbled notes back home and tried it out. After a few bumps and bruises to get it right, it worked, and here’s how to do it!
The SharePoint Picture Library by default does not provide a way to view items in Datasheet mode as a Document Library does. This can be cumbersome if you want to quickly view all images without scrolling though them. In this tutorial I’ll show you how to create a Picture Library that displays all the images in a Datasheet view as thumbnails thus allowing you to easily navigate to the full size image you would like to see. You will need a copy of SharePoint Designer 2007 in order to make the modifications shown below.
View before Modification
You will create a “Document Library” instead of the normal “Picture Library”. The standard view of document libraries does not lend itself easily to see the image, but only the name.
The Steps:
Step 1: From the Home Page, Select “View All Site Content"
Step 2: On the Quick Launch navigation bar click on “Create” to create a New “Document Library”.
Complete the “Document Library” General Settings as shown below. I selected “None” for a Document Template because I will be placing images in this library instead.
Note: A SharePoint “Best Practice” is to name the Library “Without” spaces and to keep it as short as possible. This name field creates the hyperlink to the library and there is a 260 character hyperlink limit. Adding spaces in this name adds “HTML Encoding” such as a “%20” for spaces and some mail systems may not recognize this when e-mailing links.
Step 3: View of newly created Document Library (No modifications made as yet) But before you move on, upload a few images to the library.
Step 4: Edit the “Document Library” settings
Next, we should edit the library settings and rename the library name to add spaces.
Step 5: Rename Document Library Title to add spaces in Name
You can add your spaces or rename the library here while preserving the hyperlink already created from the initial setup.
Step 6: Changing the “Document Library” name.
Here I added spaces in the name.
Step 7: Select “Advanced Settings”
Step 8: Enable the management of Content Types and remove the “New Folder” menu item from the Library. The Categorization of content in this library will now be managed through Content Types.
Step 9: Create a New Content Type by “Adding from Existing Content Types”
Step 10: Select “Picture” Content Type
Step 11: Select the “Change new button order and default content type” link from the Document Library Settings page.
Step 12: Remove (Hide) the Document Content Type
Uncheck the “Visible” appearance of the “Document” Content Type. We only want “Pictures” to be uploaded into this Library.
Step 13: Create a new View
Now we need to create a new “Thumbnail” view of the Document Library. This will create a new web page that we can modify to display in Datasheet mode.
Step 14: Select “Standard View”
Step 15: Name the new View “Thumbnails” and select your audience type.
Step 16: Select the Columns to Display in this view.
We only want to show the Linked Name of the Document (in this case, the document will be an image). Only check the “Name (linked to Document)” Column
Step 17: Choose the style.
Select the “Newsletter” style. This allows you to navigate down the page vertically only.
After you save your View settings, upload a few pictures into the Library as shown below. The view you just created will only show the Name (Link). What we want to do next is convert this view to show as a thumbnail with links.
Step 18: Open SharePoint Designer
Open SharePoint Designer and navigate to the Site Collection or Site that the Document Library resides in.
Note: You can copy and paste the URL from your browser into SharePoint Designer when you select “Open site” from the file menu.
Open the Thumbnails.aspx page by navigating the folder list to your Document Library, and then open the “Forms” folder.
Notice the Hyperlink Name or URL followed by the Display Name of your Document Library
Step 19: Convert Page to “XSLT Data View”
Since I had already uploaded a few images to the Library, you will see them being represented in the SharePoint Designer Editor, this is a nice touch. Next, right mouse click on the page and select “Convert Page to XSLT Data View” from the content menu.
Step 20: Remove the existing columns and add Name and URL
After converting the Thumbnails view to XSLT Data view, drag on the “URL Path” fields from the “Current Data Source” tab in the SharePoint Designer Task Pane. (If you don’t see this, then select “Task Panes” from the menu and choose “Data Source Library”. Navigate to the “SharePoint Libraries” and open your Document Library Data Source Properties by selecting “Show Data”)
Step 21: Convert the URL field to a Picture
Right click the URL Path field that you just dragged onto the canvas and select and format it as a picture.
Select “Yes” when prompted to confirm the Data View format change.
Step 22: Resize the picture and column
Using your mouse on the picture and column control points (just move your mouse to the bottom right corner of the image), drag the items to the correct size you want as a thumbnail.
Step 23: Save Your Changes
When you save your changes, you will be asked to “Unghost” this page. This means that the page will now be “Customized” from the SharePoint “Out-Of-The-Box” settings. Any future upgrades, Service Packs, or Hotfixes will NOT be applied to this page because it will now reside in the SharePoint Content Database instead of the File System. In addition, when you “Unghost” a page, it will become “Checked-Out” from Source Control.
Step 24: Check the page back into Source Control
Right mouse click on the page and select “Check-in”
Step 25: View Completed Modification
Selecting “Thumbnails” from the view task pane will show your Picture Library in Datasheet view format.