基于SharpIco开发图片转ICO工具网站
SharpIcoWeb
?项目介绍
SharpIcoWeb是基于SharpIco开发的图片转ICO工具网站,支持上传png、jpg等图片转换为多尺寸的Ico图片文件。采用前后端分离技术。
后端接口使用 .NET Minimal API
开发,够轻量。
?项目地址
https://github.com/ZyPLJ/SharpIcoWeb
? 应用场景
• 网站Favicon ? • 软件图标 ?️ • 个性化文件夹标识 ?
<link rel="icon" type="image/x-icon" href="/logo.ico" />
✨核心技术
⚡ | ?️ → ❌ |
?️.NET 9 MiniAPI 轻量级API开发,处理图像转换业务逻辑 | ?️ |
? | ? + ? |
✅后续更新
• 不同尺寸ICO,可分别生成ICO文件。 • 前端显示ICO文件图标数量数据、大小、偏移等数据。 • 批量转换功能。
?快速开始
Docker部署
注意注释部分配置可能需要根据实际情况修改
Docker CLI
docker-compose up --build -d
default.conf
server {
listen 5173; # 配置端口
server_name0.0.0.0; # 修改为docker服务宿主机的ip
# 设置允许的最大请求体大小(例如 100MB)
client_max_body_size100M;
location / {
root /usr/share/nginx/html;
indexindex.htmlindex.htm;
try_files $uri $uri/ /index.html =404;
}
location /api {
proxy_passhttp://backend:5235;# Docker 内部网络
proxy_set_headerHost $host;
proxy_set_headerX-Real-IP $remote_addr;
}
error_page 500502503504 /50x.html;
location = /50x.html {
root html;
}
}
Docker Compose
version: '3.8'
services:
frontend:
build:
context:./sharp-ico-vue # 指向前端目录
dockerfile:Dockerfile
ports:
-"5173:5173" # 前端映射到宿主机的5173端口
depends_on:
-backend
backend:
build:
context:. # 指向后端目录
dockerfile:Dockerfile
ports:
-"5235:5235" # 后端端口
手动部署
clone
git clone https://github.com/ZyPLJ/SharpIcoWeb.git
后端运行
cd SharpIcoWeb
dotnet build -c Release
dotnet run
前端运行
cd ..
cd sharp-ico-vue
npm install
npm run dev
?如何使用
前后端项目运行或部署后,打开运行后网址。
选择需要生成的ICO图表尺寸,可多选
上传图片文件,点击转换。? 开发指南
项目结构
sharp-ico/
├── SharpIco/ # 图标转换类库
│ ├── SharpIco.csproj
├── SharpIcoWeb/ # 后端Api项目
│ ├── SharpIcoWeb.csproj
├── sharp-ico-vue # 前端项目开发环境
运行项目
后端
dotnet build -c Release
dotnet run前端
npm install
npm run dev相关链接
推荐本站淘宝优惠价购买喜欢的宝贝:
本文链接:https://www.hqyman.cn/post/12047.html 非本站原创文章欢迎转载,原创文章需保留本站地址!
休息一下~~