Image helper class object creation

ravi bhadri asked on August 24, 2016 10:00

Hi All,

Is it possible to create ImageHelper class object with MediaFileInfo object. I have only MediaFileInfo object and I need to create imagehelper class object and i have resize the image and save it to the database.

Please help me with this.

Recent Answers

Richard Sustek answered on August 24, 2016 10:46 (last edited on August 24, 2016 10:47)


Please try avoid sending same questions both to Kentico support and Devnet at the same time, it adds unnecessary processing from our part and 2 different people may be working on the same issue.

The file is indeed unfortunately not created when the MediaFileInfo.TYPEINFO.Events.After fires. The solution here is to create a custom InfoProvider for MediaFileInfoProvider and place your code there. I have tested following code:

[assembly: RegisterCustomProvider(typeof(CustomMediaFileInfoProvider))]
public class CustomMediaFileInfoProvider : MediaFileInfoProvider
    protected override void SetMediaFileInfoInternal(MediaFileInfo mediaFile, bool saveFileToDisk, int userId, bool ensureUniqueFileName)
        // process file by system
        base.SetMediaFileInfoInternal(mediaFile, saveFileToDisk, userId, ensureUniqueFileName);

        // create thumbnails here, file exists on File system at this point
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.