Resize images on upload

Vote:
 

Hi,

I am working on a site where there will be a large number of highres images added by editors. My job is to make sure the images are automatically resized into smaller versions for tablets and mobiles. My initial thought is to hook into one of the events triggered when the editor uploads images to the Global Files folder.

Anyone done this , or something similar?

#64781
Jan 10, 2013 8:39
Vote:
 

I have tried to register my methods like this:

[InitializableModule]
public class ResizeTest : IInitializableModule
{
private bool _eventsAttached = false;
public void Initialize(InitializationEngine context)
{
if (!_eventsAttached)
{
DataFactory.Instance.CreatedContent += MyTestEvent;
DataFactory.Instance.CheckedInContent += MyTestEvent;
DataFactory.Instance.CheckingInContent += MyTestEvent;
DataFactory.Instance.CreatingPage += MyTestEvent;

_eventsAttached = true;
}

}

public void Uninitialize(InitializationEngine context)
{
DataFactory.Instance.CreatedContent -= MyTestEvent;
}

public void Preload(string[] parameters)
{

}
void MyTestEvent(object sender, ContentEventArgs e)
{
//do something here
}
}

 

Doing so, the only event I am able to trigger(through debugging) is CreatingPage, when I try to create a new page. As explained above, I want to do some processing on images after they are uploaded. When reading the SDK I get the impression that CheckingInContent or CheckedInContent are the correct events to listen to. Am I doing something wrong?

#64786
Edited, Jan 10, 2013 10:09
Vote:
 

Solved with :

UnifiedFile.UnifiedFileCheckedIn += MyTestEvent;
UnifiedFile.UnifiedFileCheckingIn += MyTestEvent;
UnifiedFile.UnifiedFileDeleting += MyTestEvent;
UnifiedFile.UnifiedFileDeleted += MyTestEvent;

#64790
Jan 10, 2013 10:45
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.