Search code examples
c#imageresizer

Determine If Uploaded Photo is Portrait or Landscape with ImageResizer


I'm trying to determine the orientation of an uploaded image. Based on this I will either one or another watermark overlay.

I had thought that I might be able to use:

HttpPostedFileBase file = base.Request.Files["photo"];
ImageResizer.ImageJob i = new ImageResizer.ImageJob(file,requestedImageInfo: null);

i.SourceWidth
i.SourceHeight

But these are always null.


Solution

  • You must call .Build() on your ImageJob to make anything happen. It's just a descriptor until executed.

    Duplicate.