In a SharePoint site definition, you can add files to a picture library just as you would any other document library. However, you will discover that while the files do show up in the picture library correctly, the thumbnails do not. This is because there are two hidden folders in a picture library “_t” and “_w”. These folders cached thumbnails of all images in the picture library. When you upload an image through the SharePoint user interface or change an image’s properties, the system will generate the appropriate cached thumbnail images for the hidden folders. However, when populating the picture library through a site definition, you must explicitly generate the thumbnail images and add them to the hidden folders.

The cached thumbnail images must take the file name of the original image file name, with an “_” in place of the “.”. Also, the thumbnail must be a JPEG file. For example, if the original image is “company_logo.png”, the thumbnail must be named “company_logo_png.jpg”.

Here is a sample set of Module sections that illustrates the results of the above process for two files: “image1.png” and image2.gif”, located in the “Resources” subdirectory of the site definiton. Their cached thumbnails are located in the “Resources_t” and “Resources_w” subdirectories.

<Module Name=”ImagePopulation” List=”109″ Url=”Picture Library” Path=”Resources” >

<!– These are the actual files –>

<File Url=”image1.png” Type=”GhostableInLibrary”/>

<File Url=”image2.gif” Type=”GhostableInLibrary”/>

</Module>

<Module Name=”ImagePopulation_t” List=”109″ Url=”Picture Library/_t” Path=”Resources_t” >

<!– These are thubmnals for the files –>

<File Url=”image1_png.jpg” Type=”GhostableInLibrary”/>

<File Url=”image2_gif.jpg” Type=”GhostableInLibrary”/>

</Module>

<Module Name=”ImagePopulation_w” List=”109″ Url=”Picture Library/_w” Path=”Resources_w” >

<!– These are thubmnals for the files –>

<File Url=”image1_png.jpg” Type=”GhostableInLibrary”/>

<File Url=”image2_gif.jpg” Type=”GhostableInLibrary”/>

</Module>

I’ve found that an easy way to generate the thumbnails is to open the original image in Windows Paint, do a Save As, and select JPG as the output format. This will work for a small number of images. If you want to generate thumbnails for a large number of images, you will probably want a more automated tool.