-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
107 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,53 @@ | ||
<!DOCTYPE html> | ||
<html lang="zh"> | ||
<html lang="zh-CN"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>照片添加时间戳水印</title> | ||
<style> | ||
#output { | ||
display: block; | ||
margin-top: 20px; | ||
max-width: 100%; | ||
height: auto; | ||
} | ||
#download { | ||
display: none; | ||
margin-top: 20px; | ||
} | ||
</style> | ||
<!-- 加载 Google Fonts 字体 Nerko One --> | ||
<link rel="preconnect" href="https://fonts.googleapis.com" /> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Nerko+One&display=swap" | ||
rel="stylesheet" | ||
/> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Handjet:[email protected]&display=swap" | ||
rel="stylesheet" | ||
/> | ||
<link | ||
href="https://fonts.googleapis.com/css2?family=Handjet:[email protected]&family=Permanent+Marker&display=swap" | ||
rel="stylesheet" | ||
/> | ||
<title>照片水印工具</title> | ||
<link rel="stylesheet" href="./src/style.css" /> | ||
</head> | ||
<body> | ||
<h1>照片添加时间戳水印</h1> | ||
<input type="file" id="upload" accept="image/*" /> | ||
<label for="fontSelect">选择字体:</label> | ||
<select id="fontSelect"> | ||
<option value="Arial">Arial</option> | ||
<option value="Courier New">Courier New</option> | ||
<option value="Georgia">Georgia</option> | ||
<option value="Times New Roman">Times New Roman</option> | ||
<option value="Verdana">Verdana</option> | ||
<option value="'Nerko One', cursive">Nerko One</option> | ||
</select> | ||
<br /> | ||
<label>选择水印位置:</label> | ||
<label> | ||
<input type="radio" name="position" value="bottom-right" checked /> 右下 | ||
</label> | ||
<label> | ||
<input type="radio" name="position" value="bottom-left" /> 左下 | ||
</label> | ||
<label> | ||
<input type="radio" name="position" value="top-right" /> 右上 | ||
</label> | ||
<label> | ||
<input type="radio" name="position" value="top-left" /> 左上 | ||
</label> | ||
<canvas id="canvas" style="display: none"></canvas> | ||
<img id="output" alt="添加水印后的图片" /> | ||
<button id="download">下载图片</button> | ||
<div class="photo-container"> | ||
<canvas id="canvas"></canvas> | ||
<img id="output" style="display: none" /> | ||
</div> | ||
|
||
<div class="controls"> | ||
<input type="file" id="upload" accept="image/*" /> | ||
<label for="fontSelect">选择字体:</label> | ||
<select id="fontSelect"> | ||
<option value="Arial">Arial</option> | ||
<option value="Verdana">Verdana</option> | ||
<option value="Times New Roman">Times New Roman</option> | ||
<option value="Nerko One">Nerko One</option> | ||
<option value="Handjet">handjet</option> | ||
<option value="Permanent Marker">Permanent Marker</option> | ||
</select> | ||
<label for="positionSelect">选择水印位置:</label> | ||
<select id="positionSelect"> | ||
<option value="bottom-right">右下角</option> | ||
<option value="bottom-left">左下角</option> | ||
<option value="top-right">右上角</option> | ||
<option value="top-left">左上角</option> | ||
</select> | ||
<button id="download" style="display: none">下载图片</button> | ||
</div> | ||
|
||
<script src="./src/script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
body { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
min-height: 100vh; | ||
margin: 0; | ||
font-family: Arial, sans-serif; | ||
} | ||
|
||
.photo-container { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
gap: 10px; | ||
margin-bottom: 20px; | ||
} | ||
|
||
#canvas { | ||
border: 1px solid #ccc; | ||
max-width: 70vw; /* 最大宽度为视口宽度的 70% */ | ||
max-height: 70vh; /* 最大高度为视口高度的 70% */ | ||
width: auto; | ||
height: auto; | ||
} | ||
|
||
.controls { | ||
display: flex; | ||
flex-wrap: wrap; | ||
justify-content: center; | ||
gap: 15px; | ||
} | ||
|
||
.controls label, | ||
.controls select, | ||
.controls button, | ||
.controls input { | ||
margin: 5px; | ||
} |