Missing thumbnail images in SharePoint?…You probably forgot to specify the "ContentType" property


During the process of creating my previous post, I discovered the thumbnail images were not rendering as expected for the custom images that I added to the out-of-the-box SharePoint /PublishingImages picture library (via a feature).

Here is the content of my original Elements.xml file (used to add the images to the library):

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module
    Name="HomeSiteImages"
    Url="PublishingImages"
    Path="HomeSiteConfiguration\PublishingImages">
    <File Url="boat.jpg" Type="GhostableInLibrary"/>
    <File Url="fame.jpg" Type="GhostableInLibrary"/>
    <File Url="ropes.jpg" Type="GhostableInLibrary"/>
  </Module>
</Elements>

To get the thumbnails to render as expected, I simply modified the Elements.xml file as follows:

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module
    Name="HomeSiteImages"
    Url="PublishingImages"
    Path="HomeSiteConfiguration\PublishingImages">
    <File Url="boat.jpg" Type="GhostableInLibrary">
      <Property Name="ContentType"
        Value="$Resources:cmscore,contenttype_image_name;" />
    </File>
    <File Url="fame.jpg" Type="GhostableInLibrary">
      <Property Name="ContentType"
        Value="$Resources:cmscore,contenttype_image_name;" />
    </File>
    <File Url="ropes.jpg" Type="GhostableInLibrary">
      <Property Name="ContentType"
        Value="$Resources:cmscore,contenttype_image_name;" />
    </File>
  </Module>
</Elements>

By simply adding the ContentType property (and setting it to “Image”), SharePoint automatically creates the corresponding thumbnail for each image when adding the item to the picture library.

Comments (1)

  1. Zackary says:

    I thumbnails that are missing from the Organization Chart under the user profiles through HTTPS, and silver-light doesn't render the thumbnails.

    Any ideas?