Coder Social home page Coder Social logo

Comments (2)

AbelianKraun avatar AbelianKraun commented on June 9, 2024 1

I will check this ASAP when I have time, I'm still configuring the environment.

from awesome-cms-core.

ngohungphuc avatar ngohungphuc commented on June 9, 2024
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

from awesome-cms-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.