当前位置: 首页 > wzjs >正文

具有营销价值好的网站国际品牌的广州网页设计

具有营销价值好的网站,国际品牌的广州网页设计,wordpress浏览人数,网站服务器排行榜让DeepSeek生成一个HTML5图片拼接工具,给的提示词如下 提示词(prompt) 帮我生成一个可以将两张图片拼接到一起的程序 支持横向拼接和竖向拼接,可以用html5实现功能吗? DeepSeek大概20秒左右就做好了,而且像这么简单的功能的话也没…

让DeepSeek生成一个HTML5图片拼接工具,给的提示词如下
提示词(prompt)
帮我生成一个可以将两张图片拼接到一起的程序 支持横向拼接和竖向拼接,可以用html5实现功能吗?
DeepSeek大概20秒左右就做好了,而且像这么简单的功能的话也没必要用python或者其他编程语言去生成,不然的话还得去配置运行环境,用HTML5直接用浏览器打开就可以了,最重要的是可以直接在DeepSeek生成的代码右边就可以直接点击运行了,连自己建一个html的文件都省去了,试了一下最终效果,还不错,任务算是完成了。
在这里插入图片描述
在这里插入图片描述
源码如下,可以新建一个html文件,源码直接复制进去双击打开即可。

<!DOCTYPE html>
<html lang="zh-CN">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>HTML5 图片拼接工具</title><style>body {font-family: Arial, sans-serif;max-width: 900px;margin: 0 auto;padding: 20px;line-height: 1.6;}h1 {color: #333;text-align: center;}.container {display: flex;flex-direction: column;gap: 20px;}.controls {display: flex;flex-wrap: wrap;gap: 15px;padding: 15px;background: #f5f5f5;border-radius: 5px;}.control-group {display: flex;flex-direction: column;gap: 5px;}button {padding: 8px 15px;background: #4CAF50;color: white;border: none;border-radius: 4px;cursor: pointer;font-size: 16px;}button:hover {background: #45a049;}select, input {padding: 8px;border-radius: 4px;border: 1px solid #ddd;}.preview {display: flex;flex-direction: column;align-items: center;gap: 15px;}#imageContainer {display: flex;flex-wrap: wrap;gap: 10px;margin-bottom: 15px;}.thumbnail {max-width: 150px;max-height: 150px;border: 1px solid #ddd;position: relative;}.thumbnail img {max-width: 100%;max-height: 100%;}.remove-btn {position: absolute;top: 0;right: 0;background: red;color: white;border: none;border-radius: 50%;width: 20px;height: 20px;font-size: 12px;cursor: pointer;}#resultCanvas {max-width: 100%;border: 1px solid #ddd;margin-top: 15px;display: none;}.download-btn {background: #2196F3;display: none;}.download-btn:hover {background: #0b7dda;}</style>
</head>
<body><h1>HTML5 图片拼接工具</h1><div class="container"><div class="controls"><div class="control-group"><label for="imageInput">选择图片:</label><input type="file" id="imageInput" accept="image/*" multiple></div><div class="control-group"><label for="modeSelect">拼接方式:</label><select id="modeSelect"><option value="horizontal">横向拼接</option><option value="vertical">竖向拼接</option></select></div><div class="control-group"><label for="spacingInput">图片间距:</label><input type="number" id="spacingInput" value="0" min="0" max="100"></div><div class="control-group"><label for="bgColor">背景颜色:</label><input type="color" id="bgColor" value="#ffffff"></div><button id="processBtn">拼接图片</button></div><div class="preview"><div id="imageContainer"></div><canvas id="resultCanvas"></canvas><button id="downloadBtn" class="download-btn">下载拼接结果</button></div></div><script>document.addEventListener('DOMContentLoaded', function() {const imageInput = document.getElementById('imageInput');const modeSelect = document.getElementById('modeSelect');const spacingInput = document.getElementById('spacingInput');const bgColor = document.getElementById('bgColor');const processBtn = document.getElementById('processBtn');const imageContainer = document.getElementById('imageContainer');const resultCanvas = document.getElementById('resultCanvas');const downloadBtn = document.getElementById('downloadBtn');let images = [];// 处理图片选择imageInput.addEventListener('change', function(e) {const files = e.target.files;if (files.length === 0) return;images = [];imageContainer.innerHTML = '';for (let i = 0; i < files.length; i++) {const file = files[i];if (!file.type.match('image.*')) continue;const reader = new FileReader();reader.onload = function(e) {const img = new Image();img.onload = function() {images.push(img);addThumbnail(img, images.length - 1);};img.src = e.target.result;};reader.readAsDataURL(file);}});// 添加缩略图function addThumbnail(img, index) {const thumbnailDiv = document.createElement('div');thumbnailDiv.className = 'thumbnail';const thumbnailImg = document.createElement('img');thumbnailImg.src = img.src;const removeBtn = document.createElement('button');removeBtn.className = 'remove-btn';removeBtn.innerHTML = '×';removeBtn.onclick = function() {images.splice(index, 1);imageContainer.removeChild(thumbnailDiv);// 重新渲染所有缩略图以更新索引imageContainer.innerHTML = '';images.forEach((img, i) => addThumbnail(img, i));};thumbnailDiv.appendChild(thumbnailImg);thumbnailDiv.appendChild(removeBtn);imageContainer.appendChild(thumbnailDiv);}// 处理拼接按钮点击processBtn.addEventListener('click', function() {if (images.length < 2) {alert('请至少选择两张图片');return;}const mode = modeSelect.value;const spacing = parseInt(spacingInput.value);const backgroundColor = bgColor.value;concatenateImages(images, mode, spacing, backgroundColor);});// 拼接图片function concatenateImages(images, mode, spacing, bgColor) {let totalWidth = 0;let totalHeight = 0;if (mode === 'horizontal') {// 横向拼接:总宽度是所有图片宽度之和 + 间距,高度取最大高度totalWidth = images.reduce((sum, img) => sum + img.width, 0) + (images.length - 1) * spacing;totalHeight = Math.max(...images.map(img => img.height));} else {// 竖向拼接:总高度是所有图片高度之和 + 间距,宽度取最大宽度totalHeight = images.reduce((sum, img) => sum + img.height, 0) + (images.length - 1) * spacing;totalWidth = Math.max(...images.map(img => img.width));}// 设置canvas尺寸resultCanvas.width = totalWidth;resultCanvas.height = totalHeight;const ctx = resultCanvas.getContext('2d');// 填充背景色ctx.fillStyle = bgColor;ctx.fillRect(0, 0, totalWidth, totalHeight);let x = 0;let y = 0;for (const img of images) {ctx.drawImage(img, x, y);if (mode === 'horizontal') {x += img.width + spacing;} else {y += img.height + spacing;}}// 显示结果和下载按钮resultCanvas.style.display = 'block';downloadBtn.style.display = 'inline-block';}// 处理下载按钮点击downloadBtn.addEventListener('click', function() {const link = document.createElement('a');link.download = '拼接结果.png';link.href = resultCanvas.toDataURL('image/png');link.click();});});</script>
</body>
</html>

文章转载自:

http://86LFXz9u.Lrdzb.cn
http://8SlpHOhz.Lrdzb.cn
http://bqcXFUcF.Lrdzb.cn
http://E2Pbtclu.Lrdzb.cn
http://Oa3N76Jn.Lrdzb.cn
http://4QuriAJ8.Lrdzb.cn
http://QmWD2gnI.Lrdzb.cn
http://ARzsZdOO.Lrdzb.cn
http://awZKkRIX.Lrdzb.cn
http://uhsu2Ycx.Lrdzb.cn
http://BdwBfv1t.Lrdzb.cn
http://v7ear0PB.Lrdzb.cn
http://ar55KHo8.Lrdzb.cn
http://TcLa4vkK.Lrdzb.cn
http://c1WxW3Kn.Lrdzb.cn
http://TqICAiUp.Lrdzb.cn
http://un7bSgtZ.Lrdzb.cn
http://CBjSQM74.Lrdzb.cn
http://fe7k0QXx.Lrdzb.cn
http://yRWYLr9h.Lrdzb.cn
http://Tk2g4Vjv.Lrdzb.cn
http://Ccx4YyVy.Lrdzb.cn
http://fNJ0CIUc.Lrdzb.cn
http://iSjXTSHf.Lrdzb.cn
http://ydCOUoi3.Lrdzb.cn
http://UrODMkhM.Lrdzb.cn
http://K0l3a014.Lrdzb.cn
http://mAJtiVqN.Lrdzb.cn
http://TRnOUild.Lrdzb.cn
http://NTVFqRWz.Lrdzb.cn
http://www.dtcms.com/wzjs/765190.html

相关文章:

  • 学做彩票网站有哪些html5网站开发实例
  • 建设微信商城网站制作深圳服务好的网站建设
  • 阿里巴巴做短视频网站海曙区建设局网站
  • 南昌网站推广电子商务网站如何设计
  • 专业的网站建设费用上海域名网站
  • 搭建门户网站网站建设介绍书
  • 免费无代码开发平台手机网站如何优化
  • zero的大型网站seo教程荷塘网站建设
  • 做推广便宜的网站包装设计网上设计平台
  • 网站建设域名服务器广州公司网站设计制作
  • 顺义推广建站现在流行什么做网站
  • 网站免费正能量直播网站建设工作进度
  • 商丘市做1企业网站的公司高端网站建设公司推荐
  • 发表评论的wordpress网站模板广西桂林自驾游最佳线路推荐
  • 五合一网站做优化好用吗摄影比赛投稿网站
  • 地方网站怎么做推广上海网站建设信息网
  • 时光轴 网站赌城网站怎么做
  • iis做的网站模板wordpress都有哪些权限
  • 免费网站地址申请做网站的详细流程
  • 公司网站网页设计如何对现有的网站改版
  • 生成论坛网站英文网站建设方案
  • 网站点击量怎么看砀山县住房和城乡建设局网站
  • 有没有专门做建筑造价的私单网站手机企业网站怎么做
  • 沧州市做网站上海市建设工程安全生产协会网站
  • 扬中网站建设要多少钱wordpress下载
  • ps做网站要多大软件开发和网站建设哪个好
  • 外贸网站建设服务创意网站页面
  • jsp类型网站托管费用工程建设信息网站资质公告
  • 做网站业务的怎么寻找客户wordpress采集查卷
  • 烟台市网站建设网站切版教程