Table of contents

Installation guide

SPImageCache

SPImageCache - SharePoint image management framework.

SPImageCache allows performing different image manipulation actions using user configured presets.

Intro

The main idea of SPImageCache is that it applies preconfigured action on image based on its (image) URL.

For instance, let’s pretend that there is an image romashka.jpg in a root folder in a pictures library called “Pictures” on our SharePoint site. Its URL will be http://[website]/Pictures/romashka.jpg

clip_image002

Suppose we got SPImageCache installed on our site and have configured our own preset to rotate image clockwise by 90 degrees and call it “rotate90”. Then if we request this image by modified like this http://[website]/imagecache/rotate90/Pictures/romashka.jpg URL, we will apply our “rotate90” action to this image. SPImageCache will create new rotated clockwise by 90 degrees image in imagecache library. And it will be accessible by URL above.

clip_image004

This modified URL could be used anywhere on the site to display images modified as we configured. Also if original image changed, SPImageCache will update modified image in imagecache library.

This is web part page with Image Viewer web parts configured to display modified images.

clip_image006

How it works

SPImageCache consists of these main parts

1. SpImageCacheHttpModule http module

2. Imagecache document library

3. SpImageCacheEventReceiver Imagecache document library event receiver

4. SPImageCacheActions list of actions

5. SPImageCachePresets list of presets

Configuration and usage

After installing SPImageCache you need to create a Preset.

But before creating your first preset you need an Action or more to be registered on the site. Action is just a list item in SPImageCacheActions list which consists of a Title and an Action Class Name fields.

Title – by this field Action will be referenced in a Preset

Action Class Name – the name of a class, which implement’s ISPImageCacheAction. It locates in SpImageCasheSDK assembly.

Below is the out of the box Scale action.

clip_image007

Well, you got some actions on the site. Now you need to create your Preset.

Preset is the named set of Actions which will be applied on the image when you request it by URL.

Also Preset is just a folder in a SPImageCachePresets list which contains SPImageCachePresetAction list items. See below.

clip_image008

Where

Title is the human readable name of SPImageCachePresetAction just to distinguish one between others.

SPImageCacheAction is a lookup field where you should select required SPImageCacheAction.

SPImageCacheActionParameters – comma separated parameters specific for selected SPImageCacheAction.

ExecutionOrder – execution order of a current SPImageCachePresetAction. Preset, as a list folder, could hold multiple SPImageCachePresetAction list items. They will be applied against image in descending order sorted by this field.

Internals

SPImageCache framework begins to process image when it requests by its URL, modified as follows:

Original - http://[website]/Pictures/romashka.jpg

Requesting SPImageCache modification -http://[website]/imagecache/scale50/Pictures/romashka.jpg

Website relative image path preceding by “imagecache” word then followed by a preset name.

SPImageCache provides out of the box preset called Scale50. It executes an action, called “Scale”, with 50% parameter.

 

To be continued …

Last edited Sep 21, 2011 at 9:56 AM by kasyanov, version 7

Comments

No comments yet.