Closed ngohungphuc closed 5 years ago
public void RunImageProcessQueue()
{
var factory = new ConnectionFactory() { HostName = "localhost" };
using (var connection = factory.CreateConnection())
using (var channel = connection.CreateModel())
{
channel.QueueDeclare(queue: QueueName.ImageResizeProcessing.ToString(),
durable: true,
exclusive: false,
autoDelete: false,
arguments: null);
//Fair dispatch setup
channel.BasicQos(prefetchSize: 0, prefetchCount: 1, global: false);
Console.WriteLine(" [*] Waiting for messages.");
var consumer = new EventingBasicConsumer(channel);
consumer.Received += (model, ea) =>
{
var body = ea.Body;
var assetMessage = Encoding.UTF8.GetString(body);
Console.WriteLine(" [x] Received {0}", assetMessage);
var imageName = assetMessage.Split("\\")[1];
var s = ProjectPath.ToApplicationPath(imageName);
var assetPath = $"{ProjectPath.GetApplicationRoot()}\\wwwroot\\{assetMessage}";
var path = "D:\\SourceCode\\Awesome-CMS-Core\\src\\AwesomeCMSCore\\AwesomeCMSCore";
using (var image = Image.Load(path))
{
image.Mutate(x => x
.Resize(295, 205)
.Grayscale());
image.Save(imageName);
}
channel.BasicAck(deliveryTag: ea.DeliveryTag, multiple: false);
};
channel.BasicConsume(queue: QueueName.ImageResizeProcessing.ToString(),
autoAck: false,
consumer: consumer);
Console.WriteLine(" Press [enter] to exit.");
Console.ReadLine();
}
Still can't resize eventhough I can load it cc @AbelianKraun
I will check this ASAP when I have time, I'm still configuring the environment.
https://github.com/SaiGonSoftware/Awesome-CMS-Core/issues/321 https://github.com/SaiGonSoftware/Awesome-CMS-Core/issues/326 https://github.com/SaiGonSoftware/Awesome-CMS-Core/issues/337