I let users upload a banner with a minimum width of 400px. This image will then get a wide of 1110px. I try to upload images with the following sizes: 960x390, 410x410, 784x250. When i upload 784x250, the image get the same size 784x250 not the width, 1110px.
I use this:
int Height;
using (var Bmp = new Bitmap(str))
{
if (Bmp.Width < 400)
{
throw;
}
if (Bmp.Height < 150)
{
throw;
}
Height = Bmp.Height;
}
if (Height > 300)
{
Height = 300;
}
str.Position = 0;
var ImageData = str.StreamToByteArray();
var Settings = "width=1110;height="+ Height + ";format=jpg;mode=crop;"
var Setting = new ResizeSettings(Settings);
using (var Out = new MemoryStream())
{
using (var In = new MemoryStream(ImageData))
{
In.Seek(0, SeekOrigin.Begin);
var I = new ImageJob(In, Out, Setting)
{
CreateParentDirectory = false
};
I.Build();
}
Out.Position = 0;
// Upload to blob
}
(str contains a stream with the image)
I want the image to be 1110px wide and max 300px high. Whats wrong?