网站微缩图

woaishapi 2011-04-08 02:48:50
很早就发现opera浏览器的一个有趣的功能,将鼠标放在网页选项卡上的时候可以看到网页的缩略图;

今天在一个网站www.293.net(查询网站价值及网站详细报告的网站)里面也发现了这个功能,就是可以看到姚查询价值的网站微缩图。。。

这个是用什么技术做的呢??? 很好奇……
...全文
135 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
le616 2011-04-08
  • 打赏
  • 举报
回复
调用cmd命令生成 图片

Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
string strOutput = null;
string commandText="IeCapt.exe所在的目录" + Environment.NewLine +@"IECapt --url=http://www.qq.com/ --out=localfile.png(图片存放的路径)";
try
{
p.Start();
p.StandardInput.WriteLine(commandText);
p.StandardInput.WriteLine("exit");
strOutput = p.StandardOutput.ReadToEnd();
p.WaitForExit();
p.Close();
}
catch (Exception e)
{

}

IeCapt.exe 下载
子夜__ 2011-04-08
  • 打赏
  • 举报
回复
步骤1 HTMl转图片

using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using mshtml;
using SHDocVw;

namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
try
{
webBrowser1.Navigate("http://www.google.com/");
while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
}

mshtml.IHTMLDocument2 doc = webBrowser1.Document.DomDocument as IHTMLDocument2;
IHTMLElementRender render = doc.body as IHTMLElementRender;

using (System.Drawing.Bitmap img = new Bitmap(webBrowser1.Width, webBrowser1.Height))
using (Graphics g = Graphics.FromImage(img))
{
IntPtr hdc = g.GetHdc();
render.DrawToDC(hdc);
g.ReleaseHdc(hdc);
img.Save("c:\\temp\\a.jpg");
}
}
catch (Exception err)
{
MessageBox.Show(err.ToString());
}
}
}

/// <remarks>
/// prototype from Tlbimp
/// </remarks>
[
Guid("3050F669-98B5-11CF-BB82-00AA00BDCE0B"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown),
ComImport
]
interface IHTMLElementRender
{
void DrawToDC([In] IntPtr hDC);
void SetDocumentPrinter([In, MarshalAs(UnmanagedType.BStr)] string bstrPrinterName, [In] IntPtr hDC);
};
}


html生成图片

步骤2 图片生成缩略图
public class ImagesTest
{
/// <summary>
/// 生成缩略图
/// </summary>
/// <param name="originalImagePath">源图路径(物理路径)</param>
/// <param name="thumbnailPath">缩略图路径(物理路径)</param>
/// <param name="width">缩略图宽度</param>
/// <param name="height">缩略图高度</param>
/// <param name="mode">生成缩略图的方式:HW,W,H,Cut</param>
public void MakeThumbnail(string originalImagePath, string thumbnailPath, int width, int height, string mode)
{
System.Drawing.Image originalImage = System.Drawing.Image.FromFile(originalImagePath);

int towidth = width;
int toheight = height;

int x = 0;
int y = 0;
int ow = originalImage.Width;
int oh = originalImage.Height;

switch (mode)
{
case "HW"://指定高宽缩放(可能变形)
break;
case "W"://指定宽,高按比例
toheight = originalImage.Height * width / originalImage.Width;
break;
case "H"://指定高,宽按比例
towidth = originalImage.Width * height / originalImage.Height;
break;
case "Cut"://指定高宽裁减(不变形)
if ((double)originalImage.Width / (double)originalImage.Height > (double)towidth / (double)toheight)
{
oh = originalImage.Height;
ow = originalImage.Height * towidth / toheight;
y = 0;
x = (originalImage.Width - ow) / 2;
}
else
{
ow = originalImage.Width;
oh = originalImage.Width * height / towidth;
x = 0;
y = (originalImage.Height - oh) / 2;
}
break;
default:
break;
}

//新建一个bmp图片
System.Drawing.Image bitmap = new System.Drawing.Bitmap(towidth, toheight);

//新建一个画板
Graphics g = System.Drawing.Graphics.FromImage(bitmap);

//设置高质量插值法
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;

//设置高质量,低速度呈现平滑程度
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

//清空画布并以透明背景色填充
g.Clear(Color.Transparent);

//在指定位置并且按指定大小绘制原图片的指定部分
g.DrawImage(originalImage, new Rectangle(0, 0, towidth, toheight),
new Rectangle(x, y, ow, oh),
GraphicsUnit.Pixel);

try
{
//以jpg格式保存缩略图
bitmap.Save(thumbnailPath, System.Drawing.Imaging.ImageFormat.Jpeg);//走这里就错了
}
catch (System.Exception e)
{
throw e;
}
finally
{
originalImage.Dispose();
bitmap.Dispose();
g.Dispose();
}
}
}


调用
/// <summary>
/// 生成缩略图
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSearch_Click(object sender, EventArgs e)
{
if (this.txtImageName.Text=="")
{
Response.Write("<script>alert('请输入图片名称');top.location.reload();</script>");
}
else if(this.txtWidth.Text=="")
{
Response.Write("<script>alert('请输入图片宽度');top.location.reload();</script>");
}
else if (this.txtHeigh.Text=="")
{
Response.Write("<script>alert('请输入图片高度');top.location.reload();</script>");
}
else
{
string images = this.txtImageName.Text.ToString();
int w = Convert.ToInt32(this.txtWidth.Text.ToString());//自己定义的图像宽度
int h = Convert.ToInt32(this.txtHeigh.Text.ToString());//自己定义的图像高度

ImagesTest imagesTest = new ImagesTest();
string images1 = Server.MapPath("ImagesI/"+images);
string images2 = Server.MapPath("ImagesII/"+images);
int width = w;
int heigh = h;
string code = "";
imagesTest.MakeThumbnail(images1, images2, width, heigh, code);
}
}

图片处理函数

步骤3 在需要的地方显示图片
咖啡 酒吧 餐饮 娱乐 通用网站程序Asp版: 功能包含: 文章管理 支持文,支持及见即所得文章发布,功能后台 ,查看,修改,删除 片管理 支持微缩,原上传,支持片简介,支持简介内片无限量上传,功能后台 ,查看,修改,删除 文展示 支持微缩,原上传,支持片简介,支持简介内片无限量上传,功能后台 ,查看,修改,删除 在线留言, 需管理员审核显示,保证留言的可靠性 自由添加模块:文模块 新闻模块 模块 反馈模块  片模块 模块 留言模块 订购模块 加盟模块 报名 模块 下载模块  产品模块 想用什么就添加什么。 自由添加频道: 修改,删除,自由添加栏目:修改,删除 支持中英文版本,以满足不同的访客需求。 数据库管理 支持系统数据库备份 数据库恢复 ,数据库恢复 ,探针组件,支持首页模板修改,支持通用页模板修改。 管理员管理  网站管理系统管理员添加,查看,修改,删除 提供首页,通用页模板PSD源文件,方便自行修改自己想要的类型。 功能强大,容易上手,功能上能彻底满足,宾馆业,咖啡厅, 酒吧、 餐饮、 娱乐行业以及个性行业需求。 ----------------------------------------------------------------------------------------------------- 后台入口:Admini/Hlogin.asp 超管账号admin ----------------------------------------------------------------------------------------------------- 演示地址:http://.51886.cn/XD/YL2/
附加JavaScript和CSS文件到你的文档。编辑CSS文件并且 匹配你的片路径,同时改变颜色匹配你网站的主题 重要:像例子中一样确定包含的JavaScript文件 具体顺序。 <link rel="stylesheet" media="screen" type="text/css" href="css/zoomimage.css" />[removed][removed][removed][removed][removed][removed]调用代码 你所需要做的所有事就是使用jQuery的方式选择一个元素并且调用插件。 $('a.myLinks').zoomimage(options); 可选项 一个哈希参数。所有的参数都是可选的。 Opacity float 控制栏和标题栏的不透明度。默认: 0.3 border integer 片的边框宽度。默认: 0 duration integer 动态化持续时间。默认: 300 译者注:控制片放大的时间和标题栏、控制栏显示的时间,两个操作不同步进行。 easing string 动画缓和。默认: linear prevent integer 拖动像前忽略的位移像素(防止鼠标的意外拖动所用)。默认: 14 译者注:防止鼠标按下后意外移动导致像发生位移。 controls boolean 是否显示控制条(如果一个片组中只有一张片,则控制条不显示)。默认: true caption boolean 是否显示标题(标题的内容来源于a标签的title属性)。默认: true centered boolean 片放大后是否在浏览器中心显示。默认: false hideSource boolean 片放大后是否影藏原微缩像。默认: false className string 用户自定义的CSS样式名。默认: false。 译者注:false时使用zoomimage.css文件,className即为css文件名同时也是css类名。 controlsTrigger string 控制标题的显示样式,'focus'像获取到焦点是显示标题,'mouseover'鼠标悬停在片上时显示标题。默认: 'focus' preload string 预处理,'click'当点击是加载片 ,'load'文档载入时就加载片。默认: 'click' onLoad function 回调函数,当像被加载的时候触发 beforeZoomIn function 回调函数,在像被放大前触发 onZoomIn function 回调函数,在像被放大时触发 beforeZoomOut function 回调函数,在像被缩小前触发 onZoomOut function 回调函数,在像被缩小时触发 onFocus function 回调函数,当片获取焦点时触发 关闭所有片或移除节点 如果你想关闭所有打开的片或像不通过触发器清除片(从DOM移除),那么你可以使用 'zoomimageClear'。这个插件的这个选择器永远是 'div.zoomimage'. $('div.zooimage').zoomimageClear();阴影设置 你可以自定义阴影。要做到这一点你必须明白如何布局框来呈现阴影。 每个CSS类负责一个特定区域的阴影。你可以在类中改变背景片的位置和大小。
前言   电子书馆,是随着电版物的出现,网络通信技术的发展,而逐渐出现的。电子书馆 ,具有存储能力大、速度快、保存时间长、成本低、便于交流等特点。光盘这-海量存 储器、能够存储比传统书高几千倍的信息,比微缩胶卷要多得多,而且包括象、视 频、声音,等等。 利用电子技术,在这一种书馆,我们能很快地从浩如烟海的书中,查找到自己所 需要的信息资料。这种书馆,保存信息量的时间要长得多,不存在霉烂、生虫等问题 。利用网络,在远在几千里、万里的单位、家中,都可以使用这种书。电子书馆, 具有存储能力大、速度快、保存时间长、成本低、便于交流等特点。光盘这一海量存储 器、能够存储比传统书高几千倍的信息,比微缩胶卷要多得多,而且包括象、视频 、声音,等等。 利用电子技术,在这一种书馆,我们能很快地从浩如烟海的书中,查找到自己所需 要的信息资料。这种书馆,保存信息量的时间要长得多,不存在霉烂、生虫等问题。 利用网络,在远在几千里、万里的单位、家中,都可以使用这种书,效率极高。 目录 第一章 需求分析 ------------------------- 5 1-1 设计背景 -------------------------- 5 1-2 用户需求分析 -------------------------- 5 1-3 拓扑结构 -------------------------- 6 1-3-1 相关介绍 -------------------- 6 1-3-2 拓扑结构 -------------------- 7 1-3-3 数据中心的网络结构 ------------ 7 第二章 硬件的选择与配置-------------------------- 9 2-1 硬件选择 --------------------------- 9 2-1-1 工作站 ----------------------- 9 2-1-2 路由器 ----------------------- 10 2-1-3 交换机 ----------------------- 11 2-1-4 双绞线 ----------------------- 11 2-1-5 光纤 ----------------------- 12 2-1-6 服务器 ----------------------- 13 2-2 硬件配置 ------------------------- 14 第三章 软件的选择与配置 ------------------------ 16 3-1 软件的选择 --------------------------- 16 3-2 软件的安装 --------------------------- 16 第四章 服务软件的配置与设计----------------------- 18 4-1 DNS配置 ---------------------------- 18 4-2 WEB配置 ---------------------------- 19 4-3 DHCP配置 ---------------------------- 20 4-4 FTP配置 ---------------------------- 21 4-5 子网划分与IP地址的分配------------------- 21 第五章 检索界面 ---------------------------- 24 6. 总结 ---------------------------- 25 参考文献 ---------------------------- 26 附录 核心代码 --------------------------- 27 课程设计任务书 【设计目的】深刻理解网络层次,熟练构建网站 【设计任务】 网站的建设要求能接入Internet;站点的设计要求有100个以上的站点,内部采用10 00M主干网,100M到点;至少要划分4个以上的子网;站点需要提供DNS、DHCP、WEB、FT P等服务;编写简单的WEB主页。 【设计要求】 对所选定的课题进行需求分析;选定网站类型及拓扑结构; 进行网站设备(主机、物理设备、交换机、路由器)的选型,子网划分及IP地址的分配 ,进行服务器、交换机和路由器的配置;对完成网络提供服务软件的选型及配置;对网 站代码的设计,并且将代码发布。 【设计提交】 项目设计报告 【设计评分】 最高分: 优秀,扩展程序的功能,可以参考因特网中成功案例的功能; 设备配置,IP描述,原代码是否完备( 60 %); 拓扑结构是否合理( 20 %); 文档是否完备,清晰,文档与程序代码是否一致( 20 %),至少包含一下内容: 系统概述运行环境编译使用方法实现环境

62,047

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧