ASP.NET Core SixLabors.ImageSharp v1.0 的图像实用程序类 web示例

这个小型实用程序库需要将 NuGet SixLabors.ImageSharp包(版本 1.0.4)添加到.NET Core 3.1/ .NET 6 / .NET 8项目中。它与Windows、Linux和 MacOS兼容。
这已针对 ImageSharp v3.0.1 进行了重新设计。
它可以根据百万像素数或长度乘以宽度来调整图像大小,并根据需要保留纵横比。
它根据EXIF数据旋转/翻转图像。这是为了适应移动设备。
它还创建散点图和直方图。
另请参阅:MVC 应用程序的位图图像创建和下载
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Metadata.Profiles.Exif;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Formats.Png;
using System.IO;
using System;
using SixLabors.ImageSharp.Formats.Jpeg;
namespace ImageUtil
{
public class GetSize
{
public GetSize(Stream stream)
{
using (Image iOriginal = Image.Load(stream))
{
stream.Position = 0;
Width = iOriginal.Width;
Height = iOriginal.Height;
}
}
/// <summary>
/// The width of the image specified in the class constructor's Stream parameter
/// </summary>
public int Width { get; }
/// <summary>
/// The height of the image specified in the class constructor's Stream parameter
/// </summary>
public int Height { get; }
}
public static class Resize
{
/// <summary>
/// Resize and save an image to a Stream specifying its new width and height
/// </summary>
public static void SaveImage(Stream imageStream, int newWidth, int newHeight, bool preserveImageRatio, Stream saveToStream, int jpegQuality = 100)
{
using (Image iOriginal = Image.Load(imageStream))
{
imageStream.Position = 0;
if (preserveImageRatio)
{
float percentWidth = newWidth / (float)iOriginal.Width;
float percentHeight = newHeight / (float)iOriginal.Height;
float percent = percentHeight < percentWidth ? percentHeight : percentWidth;
newWidth = (int)Math.Round(iOriginal.Width * percent, 0);
newHeight = (int)Math.Round(iOriginal.Height * percent, 0);
}
resize(imageStream, iOriginal, newWidth, newHeight, saveToStream, jpegQuality);
}
}
/// <summary>
/// Resize and save an image to a Stream specifying the number of pixels to resize to
/// </summary>
public static void SaveImage(Stream imageStream, int newNumberOfPixels, Stream saveToStream, int jpegQuality = 100)
{
using (Image iOriginal = Image.Load(imageStream))
{
imageStream.Position = 0;
double ratio = Math.Sqrt(newNumberOfPixels / (double)(iOriginal.Width * iOriginal.Height));
resize(imageStream, iOriginal, (int)Math.Round(iOriginal.Width * ratio, 0), (int)Math.Round(iOriginal.Height * ratio, 0), saveToStream, jpegQuality);
}
}
private static void resize(Stream origSource, Image image, int newWidth, int newHeight, Stream saveTo, int jpegQuality)
{
image.Mutate(x => x.Resize(newWidth, newHeight));
transformImage(image); // NOTE: transform image AFTER resizing it!!!
var format = Image.DetectFormat(origSource);
if (format.Name.ToLower() == "jpeg")
{
var encoder = new JpegEncoder();
encoder.Quality = jpegQuality;
image.SaveAsJpeg(saveTo, encoder);
}
else
image.Save(saveTo, format);
}
private static void transformImage(Image image)
{
IExifValue exifOrientation = image.Metadata?.ExifProfile?.GetValue(ExifTag.Orientation);
if (exifOrientation == null)
return;
RotateMode rotateMode;
FlipMode flipMode;
setRotateFlipMode(exifOrientation, out rotateMode, out flipMode);
image.Mutate(x => x.RotateFlip(rotateMode, flipMode));
image.Metadata.ExifProfile.SetValue(ExifTag.Orientation, (ushort)1);
}
private static void setRotateFlipMode(IExifValue exifOrientation, out RotateMode rotateMode, out FlipMode flipMode)
{
var orientation = (ushort)exifOrientation.GetValue();
switch (orientation)
{
case 2:
rotateMode = RotateMode.None;
flipMode = FlipMode.Horizontal;
break;
case 3:
rotateMode = RotateMode.Rotate180;
flipMode = FlipMode.None;
break;
case 4:
rotateMode = RotateMode.Rotate180;
flipMode = FlipMode.Horizontal;
break;
case 5:
rotateMode = RotateMode.Rotate90;
flipMode = FlipMode.Horizontal;
break;
case 6:
rotateMode = RotateMode.Rotate90;
flipMode = FlipMode.None;
break;
case 7:
rotateMode = RotateMode.Rotate90;
flipMode = FlipMode.Vertical;
break;
case 8:
rotateMode = RotateMode.Rotate270;
flipMode = FlipMode.None;
break;
default:
rotateMode = RotateMode.None;
flipMode = FlipMode.None;
break;
}
}
}
/* CREATE A SCATTER PLOT JPEG/PNG IMAGE */
public static class ScatterPlot
{
static readonly Rgba32 WHITE = new Rgba32(255, 255, 255);
static readonly Rgba32 BLACK = new Rgba32(0, 0, 0);
static readonly Rgba32 RED = new Rgba32(255, 0, 0);
static readonly Rgba32 BLUE = new Rgba32(0, 0, 255);
static readonly Rgba32 GREEN = new Rgba32(0, 192, 0);
static readonly Rgba32 PURPLE = new Rgba32(128, 0, 128);
static readonly Rgba32 ORANGE = new Rgba32(255, 164, 0);
static readonly Rgba32 YELLOW = new Rgba32(255, 225, 0);
static readonly Rgba32 MAGENTA = new Rgba32(255, 0, 255);
static readonly Rgba32 AQUA = new Rgba32(0, 225, 255);
static readonly Rgba32 BLUEJEAN = new Rgba32(0, 128, 255);
static readonly Rgba32 BROWN = new Rgba32(150, 75, 50);
static readonly Rgba32 CHARTREUSE = new Rgba32(223, 255, 0);
static readonly Rgba32 DODGERBLUE = new Rgba32(30, 144, 255);
static readonly Rgba32 NAVY = new Rgba32(0, 0, 128);
static readonly Rgba32 DARKRED = new Rgba32(139, 0, 0);
static readonly Rgba32[] colors = new Rgba32[] { WHITE, BLACK, RED, BLUE, GREEN, PURPLE, ORANGE, YELLOW, MAGENTA, AQUA, BLUEJEAN, BROWN, DODGERBLUE, CHARTREUSE, NAVY, DARKRED };
public static void CreateJPEG(Stream stream, ScatterPlotColors backgroundColor, IEnumerable<PlotPoint> points, int width, int height, int pointSize, int jpegQuality = 100)
{
using (var bmp = new Image<Rgba32>(width / pointSize + 6, height / pointSize + 6, colors[(int)backgroundColor]))
create(stream, width, height, bmp, points, pointSize, new JpegEncoder() { Quality = jpegQuality });
}
public static void CreateJPEG(string filename, ScatterPlotColors backgroundColor, IEnumerable<PlotPoint> points, int width, int height, int pointSize, int jpegQuality = 100)
{
using (var stream = File.Create(filename))
CreateJPEG(stream, backgroundColor, points, width, height, pointSize, jpegQuality);
}
public static void CreatePNG(Stream stream, IEnumerable<PlotPoint> points, int width, int height, int pointSize)
{
using (var bmp = new Image<Rgba32>(width / pointSize + 6, height / pointSize + 6))
create(stream, width, height, bmp, points, pointSize, new PngEncoder());
}
public static void CreatePNG(string filename, IEnumerable<PlotPoint> points, int width, int height, int pointSize)
{
using (var stream = File.Create(filename))
CreatePNG(stream, points, width, height, pointSize);
}
private static double normalize(float min, float max, float value)
{
double x = max - min;
if(x == 0)
return 0;
return (value - min) / x;
}
private static void create(Stream stream, int width, int height, Image<Rgba32> bmp, IEnumerable<PlotPoint> points, int pointSize, SixLabors.ImageSharp.Formats.IImageEncoder imageEncoder)
{
float xMax = float.MinValue, xMin = float.MaxValue, yMax = float.MinValue, yMin = float.MaxValue;
foreach (var pt in points)
{
xMax = Math.Max(pt.x, xMax);
xMin = Math.Min(pt.x, xMin);
yMax = Math.Max(pt.y, yMax);
yMin = Math.Min(pt.y, yMin);
}
float xDelta = Math.Max(1, xMax - xMin), yDelta = Math.Max(1, yMax - yMin);
int w = width / pointSize;
int h = height / pointSize;
foreach (var pt in points)
{
int x = (int)(w * normalize(xMin, xMax, pt.x));
int y = (int)(h * normalize(yMin, yMax, pt.y));
bmp[x + 3, y + 3] = colors[((int)pt.color) % colors.Length];
}
bmp.Mutate(x => x.Flip(FlipMode.Vertical));
bmp.Mutate(x => x.Resize(width, height));
bmp.Save(stream, imageEncoder);
}
}
public class PlotPoint
{
public ScatterPlotColors color { get; }
public float x { get; }
public float y { get; }
public PlotPoint(float x, float y, ScatterPlotColors color)
{
this.x = x;
this.y = y;
this.color = color;
}
}
public enum ScatterPlotColors
{
WHITE,
BLACK,
RED,
BLUE,
GREEN,
PURPLE,
ORANGE,
YELLOW,
MAGENTA,
AQUA,
BLUEJEAN,
BROWN,
CHARTREUSE,
DODGERBLUE,
NAVY,
DARKRED
}
/* CREATE A PNG HISTOGRAM OF AN IMAGE */
public static class Histogram
{
/// <summary>
/// Create a histogram from the data in a stream
/// </summary>
public static MemoryStream CreatePNG(Stream stream, int width, int height, LRGB lrgb, byte alphaChannel = 128, bool clipBlackAndWhite = true, byte luminanceShade = 255)
{
using (var bmp = Image<Rgb24>.Load(stream))
{
return create(bmp, width, height, lrgb, alphaChannel, clipBlackAndWhite, luminanceShade);
}
}
/// <summary>
/// Create a histogram from the data in a file
/// </summary>
public static MemoryStream CreatePNG(string filename, int width, int height, LRGB lrgb, byte alphaChannel = 128, bool clipBlackAndWhite = true, byte luminanceShade = 255)
{
using (var bmp = Image<Rgb24>.Load(filename))
{
return create(bmp, width, height, lrgb, alphaChannel, clipBlackAndWhite, luminanceShade);
}
}
private static MemoryStream create(Image bmp, int width, int height, LRGB lrgb, byte alpha, bool clip, byte shade)
{
ulong[] lumin = new ulong[256];
ulong[] red = new ulong[256];
ulong[] green = new ulong[256];
ulong[] blue = new ulong[256];
var bred = (lrgb & LRGB.RED) != 0;
var bgreen = (lrgb & LRGB.GREEN) != 0;
var bblue = (lrgb & LRGB.BLUE) != 0;
var blumin = (lrgb == LRGB.LUMINANCE);
int w = bmp.Width;
int h = bmp.Height;
var bmp2 = bmp.CloneAs<Rgb24>();
for (int y = 0; y < h; y++)
{
Span<Rgb24> pixelRow = bmp2.GetPixelRowSpan(y);
for (int x = 0; x < w; x++)
{
var c = pixelRow[x];
lumin[(int)Math.Round((c.R + c.G + c.B) / 3.0)]++;
red[c.R]++;
green[c.G]++;
blue[c.B]++;
}
}
ulong max = 0;
int a = (clip ? 1 : 0), b = (clip ? 255 : 256);
for (int i = a; i < b; i++)
{
if (!blumin)
{
if (bred)
if (max < red[i])
max = red[i];
if (bgreen)
if (max < green[i])
max = green[i];
if (bblue)
if (max < blue[i])
max = blue[i];
}
else if (max < lumin[i])
max = lumin[i];
}
double HEIGHTFACTOR = 256.0 / max;
if (blumin)
{
using (var bmplum = new Image<Rgba32>(256, 256))
{
var penlum = new VerticalPen(new Rgba32(shade, shade, shade, alpha));
for (int i = 0; i < 256; i++)
penlum.Draw(bmplum, i, (int)(lumin[i] * HEIGHTFACTOR));
bmplum.Mutate(x => x.Resize(width, height));
MemoryStream ms = new MemoryStream();
bmplum.Save(ms, new PngEncoder());
return ms;
}
}
else
{
using (var bmppre = new Image<Rgba32>(256, 256))
{
Image<Rgba32>? bmpred = null, bmpgreen = null, bmpblue = null;
VerticalPen? penred = null, pengreen = null, penblue = null;
if (bred)
{
bmpred = new Image<Rgba32>(256, 256);
penred = new VerticalPen(new Rgba32(255, 0, 0, alpha));
}
if (bgreen)
{
bmpgreen = new Image<Rgba32>(256, 256);
pengreen = new VerticalPen(new Rgba32(0, 255, 0, alpha));
}
if (bblue)
{
bmpblue = new Image<Rgba32>(256, 256);
penblue = new VerticalPen(new Rgba32(0, 0, 255, alpha));
}
for (int i = 0; i < 256; i++)
{
if (bred)
penred.Draw(bmpred, i, (int)(red[i] * HEIGHTFACTOR));
if (bgreen)
pengreen.Draw(bmpgreen, i, (int)(green[i] * HEIGHTFACTOR));
if (bblue)
penblue.Draw(bmpblue, i, (int)(blue[i] * HEIGHTFACTOR));
}
if (bred)
{
bmppre.Mutate(x => x.DrawImage(bmpred, 1));
bmpred.Dispose();
}
if (bgreen)
{
bmppre.Mutate(x => x.DrawImage(bmpgreen, 1));
bmpgreen.Dispose();
}
if (bblue)
{
bmppre.Mutate(x => x.DrawImage(bmpblue, 1));
bmpblue.Dispose();
}
bmppre.Mutate(x => x.Resize(width, height));
MemoryStream ms = new MemoryStream();
bmppre.Save(ms, new PngEncoder());
return ms;
}
}
}
internal class VerticalPen
{
private readonly Rgba32 color;
public VerticalPen(Rgba32 color)
{
this.color = color;
}
public void Draw(Image<Rgba32> bmp, int row, int height)
{
if (height <= bmp.Height)
for (int y = height - 1; y >= 0; y--)
bmp[row, bmp.Height - 1 - y] = color;
}
}
public enum LRGB
{
LUMINANCE = 0,
RED = 1,
GREEN = 2,
BLUE = 4,
REDBLUE = 1 | 4,
REDGREEN = 1 | 2,
BLUEGREEN = 2 | 4,
REDGREENBLUE = 1 | 2 | 4
}
}
}
示例用法
另请参阅:控制台应用程序示例
这是MVC Web 应用程序中的视图。
@{
ViewData["Title"] = "/Home/UploadImages";
}
<div class="text-center">
<h1 class="display-4">UploadImages</h1>
<form enctype="multipart/form-data" method="post">
<div>
<input type="file" name="images" accept="image/jpeg, image/gif, image/png" multiple />
</div>
<div>
<button type="submit" class="btn btn-primary">UPLOAD</button>
</div>
</form>
@if(Model is int)
{
<p>@Model images saved.</p>
}
</div>
现在介绍控制器代码:
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.TagHelpers;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using WebApplication1.Models;
namespace WebApplication1.Controllers
{
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
public HomeController(ILogger<HomeController> logger)
{
_logger = logger;
}
public IActionResult UploadImages()
{
return View();
}
[HttpPost]
[DisableRequestSizeLimit] // NOTE: NOT RECOMMENDED - SET A LIMIT
public IActionResult UploadImages(IFormCollection form)
{
int count = 0;
foreach(var image in form.Files)
{
if(image.ContentType.StartsWith("image/"))
{
using (var openfs = image.OpenReadStream())
{
string filename = "thumbnail-" + image.FileName;
if (System.IO.File.Exists(filename))
System.IO.File.Delete(filename);
using (var savefs = System.IO.File.OpenWrite(filename))
{
// NOTE: RESIZE IMAGE TO 10K PIXEL THUMBNAIL; THIS WILL ALSO FLIP AND ROTATE IMAGE AS NEEDED
ImageUtil.Resize.SaveImage(openfs, 10000, savefs);
count++;
}
}
}
}
return View(count);
}
public IActionResult Index()
{
return View();
}
public IActionResult Privacy()
{
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}
如果您喜欢此文章,请收藏、点赞、评论,谢谢,祝您快乐每一天。
相关文章:
ASP.NET Core SixLabors.ImageSharp v1.0 的图像实用程序类 web示例
这个小型实用程序库需要将 NuGet SixLabors.ImageSharp包(版本 1.0.4)添加到.NET Core 3.1/ .NET 6 / .NET 8项目中。它与Windows、Linux和 MacOS兼容。 这已针对 ImageSharp v3.0.1 进行了重新设计。 它可以根据百万像素数或长度乘以宽度来调整图像大…...
ffmpeg configure 研究1-命令行参数的分析
author: hjjdebug date: 2025年 02月 14日 星期五 17:16:12 CST description: ffmpeg configure 研究1 ./configure 命令行参数的分析 文章目录 1 configure 对命令行参数的分析,在4019行1.1 函数名称: is_in1.2. 函数名称: enable1.3. 函数名称: set_all 2 执行退出判断的关键…...
数据结构与算法之排序算法-归并排序
排序算法是数据结构与算法中最基本的算法之一,其作用就是将一些可以比较大小的数据进行有规律的排序,而想要实现这种排序就拥有很多种方法~ 那么我将通过几篇文章,将排序算法中各种算法细化的,详尽的为大家呈现出来: …...
高血压危险因素分析(项目分享)
高血压危险因素分析(项目分享) 高血压作为一种极为常见的慢性疾病,正严重威胁着大众健康。它的发病机制较为复杂,涉及多个方面的因素。 在一份临床采集的数据的基础上,我们通过数据分析手段深入观察一下 BMI…...
java集合框架之Map系列
前言 首先从最常用的HashMap开始。HashMap是基于哈希表实现的,使用数组和链表(或红黑树)的结构。在Java 8之后,当链表长度超过阈值时会转换为红黑树,以提高查询效率。哈希冲突通过链地址法解决。需要明确的是ÿ…...
android设置添加设备QR码信息
摘要:客户衍生需求,通过扫QR码快速获取设备基础信息,并且基于POS SDK进行打印。 1. 定位至device info的xml添加相关perference Index: vendor/mediatek/proprietary/packages/apps/MtkSettings/res/xml/my_device_info.xml--- vendor/medi…...
Python实现微博关键词爬虫
1.背景介绍 随着社交媒体的广泛应用,微博上的海量数据成为了很多研究和分析的重要信息源。为了方便获取微博的相关内容,本文将介绍如何使用Python编写一个简单的爬虫脚本,从微博中抓取指定关键词的相关数据,并将这些数据保存为Ex…...
linux概念详解
用户守护进程 用户空间守护进程是一些在后台运行的长期服务程序,提供系统级服务。 下面举一些例子。 网络服务: 如sshd(SSH服务)、httpd(HTTP服务)。 sshd:sshd 守护进程会在后台运行&#x…...
【设计模式】-工厂模式(简单工厂、工厂方法、抽象工厂)
工厂模式(简单工厂、工厂方法、抽象工厂) 介绍 简单工厂模式 简单工厂模式不属于23种GoF设计模式之一,但它是一种常见的设计模式。它提供了一种创建对象的接口,但由子类决定要实例化的类是哪一个。这样,工厂方法模式让类的实例化推迟到子类…...
AMESim中批处理功能的应用
AMESim 软件的批处理功能是一项能显著提高仿真效率和灵活性的功能,以下是其介绍与应用说明: 一 功能介绍 参数扫描功能:用户可以指定模型中一个或多个参数的取值范围和步长,批处理功能会自动遍历这些参数组合,进行多…...
《Spring实战》(第6版)第1章 Spring起步
第1部分 Spring基础 第1章 Spring起步 1.1 什么是Spring Spring的核心是提供一个容器(container)。 称为Spring应用上下文(Spring application context)。 创建和管理应用的组件(bean),与上下文装配在一起。 Bean装配通过依赖注入(Dependency Injection,DI)。…...
E卷-特殊的加密算法-(200分)
专栏订阅🔗 特殊的加密算法 问题描述 有一种特殊的加密算法,明文为一段数字串,经过密码本查找转换,生成另一段密文数字串。规则如下: 明文为一段由 0-9 组成的数字串。密码本为由数字 0-9 组成的二维数组。需要按明文串的数字顺序在密码本里找到同样的数字串,密码本里…...
QT 异步编程之多线程
一、概述 1、在进行桌面应用程序开发的时候,假设应用程序在某些情况下需要处理比较复制的逻辑,如果只有一个线程去处理,就会导致窗口卡顿,无法处理用户的相关操作。这种情况下就需要使用多线程,其中一个线程处理窗口事…...
K-均值(K-means)
K-均值(K-means)是一种常用的无监督学习算法,用于将数据集中的样本分成 K 个簇。该算法的过程大致如下: 1. 随机初始化 K 个聚类中心(centroid)。 2. 将每个样本分配到与其最近的聚类中心所代表的簇。 3. …...
AI agent 未来好的趋势:AI医疗影像、智能客服、个性化推荐
AI agent 未来好的趋势:AI医疗影像、智能客服、个性化推荐 目录 AI agent 未来好的趋势:AI医疗影像、智能客服、个性化推荐比特币AI Agents稳定币扩容区块链AI基础设施AI驱动的软件应用AI赋能的行业应用AI医疗影像、智能客服、个性化推荐AI药物研发比特币 市场与机构化:2024…...
接入 SSL 认证配置:满足等保最佳实践
前言 随着信息安全形势的日益严峻,等保(信息安全等级保护)要求成为各行业信息系统必须遵守的标准。在数据库领域,OpenGauss作为一款高性能、安全、可靠的开源关系型数据库,也需要满足等保要求,确保数据的安…...
微软AutoGen高级功能——Selector Group Chat
介绍 大家好,这次给大家分享的内容是微软AutoGen框架的高级功能Selector Group Chat(选择器群聊),"选择器群聊"我在给大家分享的这篇博文的代码中有所体现微软AutoGen介绍——Custom Agents创建自己的Agents-CSDN博客,但是并没有详…...
w206基于Spring Boot的农商对接系统的设计与实现
🙊作者简介:多年一线开发工作经验,原创团队,分享技术代码帮助学生学习,独立完成自己的网站项目。 代码可以查看文章末尾⬇️联系方式获取,记得注明来意哦~🌹赠送计算机毕业设计600个选题excel文…...
Springboot中使用Elasticsearch(部署+使用+讲解 最完整)
目录 引言 一、docker中安装Elasticsearch 1、创建es专有的网络 2、开放端口 3、在es-net网络上安装es和kibana 4、可能出现的问题 5、测试 6、安装IK分词器 7、测试IK分词器 二、结合业务实战 1、准备依赖 2、配置yml 3、读取yml配置 4、准备es配置类 5、编写测…...
深度求索—DeepSeek API的简单调用(Java)
DeepSeek简介 DeepSeek(深度求索)是由中国人工智能公司深度求索(DeepSeek Inc.)研发的大规模语言模型(LLM),专注于提供高效、智能的自然语言处理能力,支持多种场景下的文本生成、对…...
conda相比python好处
Conda 作为 Python 的环境和包管理工具,相比原生 Python 生态(如 pip 虚拟环境)有许多独特优势,尤其在多项目管理、依赖处理和跨平台兼容性等方面表现更优。以下是 Conda 的核心好处: 一、一站式环境管理:…...
linux之kylin系统nginx的安装
一、nginx的作用 1.可做高性能的web服务器 直接处理静态资源(HTML/CSS/图片等),响应速度远超传统服务器类似apache支持高并发连接 2.反向代理服务器 隐藏后端服务器IP地址,提高安全性 3.负载均衡服务器 支持多种策略分发流量…...
【学习笔记】深入理解Java虚拟机学习笔记——第4章 虚拟机性能监控,故障处理工具
第2章 虚拟机性能监控,故障处理工具 4.1 概述 略 4.2 基础故障处理工具 4.2.1 jps:虚拟机进程状况工具 命令:jps [options] [hostid] 功能:本地虚拟机进程显示进程ID(与ps相同),可同时显示主类&#x…...
如何在最短时间内提升打ctf(web)的水平?
刚刚刷完2遍 bugku 的 web 题,前来答题。 每个人对刷题理解是不同,有的人是看了writeup就等于刷了,有的人是收藏了writeup就等于刷了,有的人是跟着writeup做了一遍就等于刷了,还有的人是独立思考做了一遍就等于刷了。…...
JS手写代码篇----使用Promise封装AJAX请求
15、使用Promise封装AJAX请求 promise就有reject和resolve了,就不必写成功和失败的回调函数了 const BASEURL ./手写ajax/test.jsonfunction promiseAjax() {return new Promise((resolve, reject) > {const xhr new XMLHttpRequest();xhr.open("get&quo…...
mac 安装homebrew (nvm 及git)
mac 安装nvm 及git 万恶之源 mac 安装这些东西离不开Xcode。及homebrew 一、先说安装git步骤 通用: 方法一:使用 Homebrew 安装 Git(推荐) 步骤如下:打开终端(Terminal.app) 1.安装 Homebrew…...
【堆垛策略】设计方法
堆垛策略的设计是积木堆叠系统的核心,直接影响堆叠的稳定性、效率和容错能力。以下是分层次的堆垛策略设计方法,涵盖基础规则、优化算法和容错机制: 1. 基础堆垛规则 (1) 物理稳定性优先 重心原则: 大尺寸/重量积木在下…...
表单设计器拖拽对象时添加属性
背景:因为项目需要。自写设计器。遇到的坑在此记录 使用的拖拽组件时vuedraggable。下面放上局部示例截图。 坑1。draggable标签在拖拽时可以获取到被拖拽的对象属性定义 要使用 :clone, 而不是clone。我想应该是因为draggable标签比较特。另外在使用**:clone时要将…...
代理服务器-LVS的3种模式与调度算法
作者介绍:简历上没有一个精通的运维工程师。请点击上方的蓝色《运维小路》关注我,下面的思维导图也是预计更新的内容和当前进度(不定时更新)。 我们上一章介绍了Web服务器,其中以Nginx为主,本章我们来讲解几个代理软件:…...
基于django+vue的健身房管理系统-vue
开发语言:Python框架:djangoPython版本:python3.8数据库:mysql 5.7数据库工具:Navicat12开发软件:PyCharm 系统展示 会员信息管理 员工信息管理 会员卡类型管理 健身项目管理 会员卡管理 摘要 健身房管理…...
