5

What are the drawbacks or benefits of storing images in the hive versus a list within the farm?

I have a debate with my colleague that deals with where to place images that must be accessible across the farm. I feel that for images that need to be accessed from anywhere, I should place them in the hive. The other opinion is that the images should be placed in a list somewhere within the farm.

1

3 Answers 3

10

The key word in your question is "farm", and this answers your question for you: HIVE.

THE HIVE

The SharePoint hive was designed to house a single instance of those files which are used across all the sites and web apps within a SharePoint farm (regardless of the site type or branding etc).

An example...

A typical corporate SharePoint topology might feature an intranet site, a projects site and even a collaboration portal all within a single farm.

Whilst each of these applications are all branded slightly differently, the common pieces like company logos and the core CSS (which defines the corporate font face, colour, size etc) must be the same across all the web apps. These files are the perfect candidates to store in the SharePoint hive because if your company changes its logo or colour scheme, then you only need to replace the one file and all the web apps will get updated instantaneously.

THE STYLE LIBRARY

Placing files in the Style Library (which is created when the Publishing Infratsructure feature has been enabled) offers one advantage over the hive: version control. As with all files that are stored in lists, you get a full update history and rollback functionality.

The main disadvantage of storing your CSS and images in this list though is scope. Files that are uploaded to lists can not be shared outside of that particular site collection. And for an application like an intranet which would most likely contain many site collections, you'd need to use a feature to provison copies of all your images, CSS and masterpages to every site collection in order to maintain a consistent look & feel. And in the case of the example above, you'd need to replicate this across all site collections in all your web apps!

As with anything in SharePoint it's always good to follow Microsoft's lead. They use the hive as the root location for all their branding files (which define the default theme that is applied to any new site) and then they deploy any additional site-specific branding files to the Style Library list within those sites.

1
  • Thanks for your comments. I believe, as you do, that there is a clear distinction between content generated by users vs. that which is installed by IT. Specific content, such as Branding, that must be available Farm wide, yet out of the user's ability to manage, is a good example of leveraging a Hive location. A Style Library is a good choice for imagery that is content created by users. This type of imagery is more dynamic in nature and tends to have a narrow scope.
    – Mike T
    Mar 7, 2012 at 19:49
2

The final answer to this is that both will provide images which can be used for branding.

There are reasons for both, however I believe the better way (especially when using publishing) is to use the Style Library in a site to insert branding images.

Images are then stored in the content DB, and when a content DB is restored (e.g. DR scenario), the images will still be available to the farm for branding.

There is a performance hit for BLOBs in SQL, that's true: but if this were the reason you wouldn't add images, I would suggest not using SharePoint as document/image libraries are what SharePoint is designed to manage (yes there is RBS for storing documents on a file system if required).

Adding images to the 12-Hive (dpeloyed say via a feature in a WSP package) could work as well, and provide greater reach (farm scoped) for branding.

You could have a master Branding library and have styles linking to them (using absolute paths).

In summary, most images I would put in a library inside of SharePoint. This helps ensure your branding will follow your site(s) where-ever they go, and makes managing them much easier. They can still be available throughout the whole farm anyway.

3
  • 1
    Are you suggesting that you create a document library (which is only site-scoped) and then use hard-coded URLs to access the files within it (to mimic farm-scoping)? No offense, but that's just hideous. The entire purpose of the hive is to act as [and I'm quoting the "Practical SharePoint 2010 Branding and Customization" book here] "a root location for all of the branding support files."
    – user4545
    Mar 1, 2012 at 2:53
  • Even images available from the hive are hard-coded: the only difference is that they can be relative too.
    – Russell
    Mar 1, 2012 at 5:14
  • Don't misunderstand me, to manage scope the HIVE can be the correct place to put branding image files. Just be careful that content that should be in Libraries doesn't get put in the Hive just because they don't want blobs stored in the content db.
    – Russell
    Mar 1, 2012 at 5:16
1

I lean towards the hive for two reasons: one is as you mentioned, it's globally available and I find easier to manage. The other is anything in a list or library is blob-ified into SQL, therefore to call your images for your branding, SharePoint calls SQL to get the files (of course you should use blob caching here to help with the performance).

The biggest benefit of keeping the images in a library in SharePoint is that they're easily updatable, you can modify your images and such just by uploading a new image.

1
  • Use image sprites too!
    – Louis
    Mar 1, 2012 at 3:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.