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.
I believe _t stands for thumbnail. Do you want what the _w stands for?
Is there any way around the thumbnails converting to jpg? I'm having a problem with the quality of the images being sacrificed when they are converted to jpg (originally png). Thanks for your help (I knot this is an old post!)
Michelle,
There are really two scenarios when talking about image thumbnails. The first is the automatic thumbnails that SharePoint generates when a user uploads an image through the UI. The second is the explicit population of an image library through Modules (discussed in this post).
I don't know what is involved in overriding SharePoint's default behavior in the first scenario.
I have not tried using other file formats when explicitly creating thumbnails for the second scenario. My guess is that the Picture Library list type explicitly looks for a JPG image to use for the thumbnail, but you could give it a shot with other file formats.
Good luck,
-Eugene
Thanks ! This really helped solving my problem when creating a custom site definition and uploading pictures to a library.
Hi, we seeing an issue with Image Library> preview thumbnail image in sharepoint 2010
The preview image is getting dispalyed as red blocked sign "X" in the image libray
when i checked the url properties of that thumbnail its GIF image and its been coverted to JPG.
and the image is not found in the server under _t folder.
but i could see the images in picute library folder.
so you see why the thumbnail image is not getting rendered or generated after the upload ?
please let me know! thanks in advance
-Sathish.Gopi87@gmail.com
This post was written for SharePoint 2007. It is not updated for SharePoint 2010.