Loading...
"); + + var fileName = $("#img-search-input").val(); + + imageManipulationDemo.controllers.image.getImage(fileName) + .then(function (imageFile) { + var src = "data:image/png;base64," + imageFile; + var img = "Could not find the image...
"); + }); + }); +}); +``` + +Now, we can run the application and see the Image Manipulation System in action: + + + +The results are impressive for the example above: + +* The original image was 12 KB and now the compressed & resized image has been reduced to 8 KB. +* The original image was 225x225 and now resized as 200x200. + +## Conclusion + +In this article, I have shown you how to compress and/or resize images with ABP Framework's Image Manipulation System by just defining some attributes to the top of the controller actions. + +Also, I have shown that you can use the BLOB Storing System to store file contents and compress/resize images before saving them into BLOB Storages thanks to the image resizers/compressors provided by ABP Framework. + +## See Also + +* [BLOB Storing](https://docs.abp.io/en/abp/latest/Blob-Storing) +* [Image Manipulation](https://docs.abp.io/en/abp/7.3/Image-Manipulation#iimageresizer) diff --git a/docs/en/Community-Articles/2023-07-03-Image-Compression-And-Resize/image-manipulation.gif b/docs/en/Community-Articles/2023-07-03-Image-Compression-And-Resize/image-manipulation.gif new file mode 100644 index 0000000000..d8b2a10c16 Binary files /dev/null and b/docs/en/Community-Articles/2023-07-03-Image-Compression-And-Resize/image-manipulation.gif differ diff --git a/docs/en/Community-Articles/2023-07-03-Image-Compression-And-Resize/image-upload-ui.png b/docs/en/Community-Articles/2023-07-03-Image-Compression-And-Resize/image-upload-ui.png new file mode 100644 index 0000000000..d5fab5a945 Binary files /dev/null and b/docs/en/Community-Articles/2023-07-03-Image-Compression-And-Resize/image-upload-ui.png differ diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs index b35efb6f36..ec0d2aacfe 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs @@ -83,7 +83,7 @@ public class SuiteCommand : IConsoleCommand, ITransientDependency case null: await InstallSuiteIfNotInstalledAsync(currentSuiteVersionAsString); _abpSuitePort = await _suiteAppSettingsService.GetSuitePortAsync(currentSuiteVersionAsString); - RunSuite(); + RunSuite(commandLineArgs); break; case "generate": @@ -418,7 +418,7 @@ public class SuiteCommand : IConsoleCommand, ITransientDependency CmdHelper.RunCmd("dotnet tool uninstall " + SuitePackageName + " -g"); } - private void RunSuite() + private void RunSuite(CommandLineArgs commandLineArgs) { try { @@ -433,11 +433,16 @@ public class SuiteCommand : IConsoleCommand, ITransientDependency { Logger.LogWarning("Couldn't check ABP Suite installed status: " + ex.Message); } - + + var targetSolution = GetTargetSolutionOrNull(commandLineArgs); + var launchUrl = targetSolution == null? + $"http://localhost:{_abpSuitePort}": + $"http://localhost:{_abpSuitePort}/CrudPageGenerator/Create?targetSolution={targetSolution}"; + if (IsSuiteAlreadyRunning()) { Logger.LogInformation("Opening suite..."); - CmdHelper.Open($"http://localhost:{_abpSuitePort}"); + CmdHelper.Open(launchUrl); return; } @@ -447,7 +452,28 @@ public class SuiteCommand : IConsoleCommand, ITransientDependency return; } - CmdHelper.RunCmd("abp-suite"); + if (targetSolution == null) + { + CmdHelper.RunCmd("abp-suite"); + } + else + { + new Thread(OpenSuiteInBrowserWithLaunchUrl).Start(); + + CmdHelper.RunCmd("abp-suite --no-browser"); + + void OpenSuiteInBrowserWithLaunchUrl() + { + Thread.Sleep(2500); // needed for suite to be ready. + CmdHelper.Open(launchUrl); + } + } + } + + private object GetTargetSolutionOrNull(CommandLineArgs commandLineArgs) + { + return commandLineArgs.Options.GetOrNull(Options.Crud.Solution.Short, Options.Crud.Solution.Long) + ?? Directory.GetFiles(Directory.GetCurrentDirectory(), "*.sln", SearchOption.TopDirectoryOnly).FirstOrDefault(); } private Process StartSuite() diff --git a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj index bf8c9a209d..c250d07eee 100644 --- a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj +++ b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj @@ -28,7 +28,7 @@