byte[] array = null;
try
{
using (var request = new HttpRequest())
{
var url = "https://dushlux.ru/upload/resize_cache/iblock/429/400_400_1/devon_devon_music_komplekt_mebeli_tsvet_cream.jpg";
request.ReconnectLimit = 1;
request.ReconnectDelay = 50;
request.KeepAlive = true;
request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36";
request.AllowAutoRedirect = true;
request.MaximumAutomaticRedirections = 5;
request["Upgrade-Insecure-Requests"] = "1";
request["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3";
request["Accept-Language"] = "ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7";
array = request.Get(url).ToBytes();
if (array == null)
{
project.SendErrorToLog("", "2_Response пуст", true);
return null;
}
}
}
catch (HttpException e)
{
return null;
}
using (var bmp = new Bitmap(new MemoryStream(array)))
{
using (var bmpNew = new Bitmap(bmp, 700, 700))
{
bmpNew.Save(@"D:\ZennoPoster\TEST\IMAGE\rsgsg.jpeg", ImageFormat.Jpeg);
}
}