We have a requirement where we want to abort publishing and throw an alert if page has a image which is more than 200 KB.
I am trying below event system code :
[TcmExtension("PageEventHandlerExtension")]
public class PageEventHandler : TcmExtension
{
public PageEventHandler()
{
Subscribe();
}
public void Subscribe()
{
EventSystem.Subscribe<Page, PublishOrUnPublishEventArgs>(PagePublishOrUnpublishAction, EventPhases.Initiated);
}
private static void PagePublishOrUnpublishAction(Page page, PublishOrUnPublishEventArgs args, EventPhases phase)
{
//Logic to fetch images from Page object and see the size of image is greater then 200KB
}
}
is it possible to fetch all publishable images from Page Object ?