asp
也可以擴展ImageTransform實現自己的圖片變換類
下面使用ASP
數據庫
CREATE TABLE t_images
(
image_id INT
image_data IMAGE
last_modified_date
)
Default
Code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default
<%@ Register Assembly="Microsoft
<!DOCTYPE html PUBLIC "
<html xmlns="
<head runat="server">
<title></title>
</head>
<body>
<form id="form
<div>
<asp:DataList ID="DataList
RepeatDirection="Horizontal" CellPadding="
<ItemTemplate>
<cc
Timestamp=’<%# Eval("last_modified_date") %>’>
<Parameters>
<cc
</Parameters>
</cc
<br />
</ItemTemplate>
</asp:DataList>
</div>
<asp:SqlDataSource ID="SqlDataSource
ProviderName="System
</asp:SqlDataSource>
</form>
</body>
</html>
ImageHandler
<%@ WebHandler Language="C#" CodeBehind="ImageHandler
ImageHandler
Code
using System;
using System
using System
using System
using Microsoft
using System
using System
using System
namespace NET
{
public class ImageHandler
{
public ImageHandler
{
this
this
this
this
}
public override ImageInfo GenerateImage(NameValueCollection parameters)
{
int imageID = int
SqlConnection connection = new SqlConnection(
@"Data Source=
connection
SqlCommand command = new SqlCommand("select image_data from t_images where image_id=" + imageID
SqlDataReader dr = command
dr
return new ImageInfo((Byte[])dr[
}
}
public class CopyrightTransform : ImageTransform
{
private const int VERTICAL_PADDING =
private const int HORIZONAL_PADDING =
public string Text { get; set; }
public Font Font { get; set; }
public Color FontColor { get; set; }
public CopyrightTransform()
{
//Assign Defaults
FontColor = Color
Font = new Font("Courier"
}
public override System
{
Graphics gra = Graphics
SizeF sz = gra
gra
return img;
}
public override string UniqueString
{
get
{
return base
}
}
}
}
From:http://tw.wingwit.com/Article/program/net/201311/14282.html