November Happy Hour will be moved to Thursday December 5th.

Create thumbnail while uploading image

Vote:
 

Hi, 

I want to create a thumbnail while uploading an image. 
How can this be done? Is there an event that I can use? 

 

// Nicke

#44974
Oct 24, 2010 12:06
Vote:
 

There is an event, but I'm a much bigger fan of doing this on-request, and storing (caching) the result.  We insert the image on the page with a URL to a thumbnail script, and pass the desired width as a querystring arg.  Like this:

/thumbnail.ashx?f=/my-image.jpg&w=200

Then, we resize the image, cache the result (the key is an MD5 hash of the querystring arguments), and return the image.  Future requests access the same image.

#44975
Edited, Oct 24, 2010 20:36
Vote:
 

Thanx, but what event is it? 

#45159
Nov 01, 2010 22:49
Vote:
 

We used these two:

EPiServer.Web.Hosting.UnifiedFile.UnifiedFileDeleting
EPiServer.Web.Hosting.UnifiedFile.UnifiedFileMoving

In Visual Studio, type...

EPiServer.Web.Hosting.UnifiedFile.

...and Intellisense will give you a bunch of them.  There are about a dozen.

#45160
Nov 01, 2010 22:55
Vote:
 

A bit late, but you should handle:
UnifiedFile.UnifiedFileChanged
UnifiedDirectory.UnifiedFileAdding

In additon to those Deane mentions above.

#45231
Nov 03, 2010 10:43
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.