AspJpeg使用方法范例  ASP教程 PHP易吧--

来源:百度文库 编辑:神马文学网 时间:2024/04/27 17:45:33

AspJpeg使用方法范例 

相关下载: AspJpeg破解版下载

1、如何创建一个AspJpeg实例?
Set Jpeg = Server.CreateObject("Persits.Jpeg")

2、如何查看到期时间(是否注册成功)?
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Response.Write Jpeg.Expires
注册成功则到期时间为:9999-9-9
否则为:安装日期加1个月期限

3、如何用AspJpeg组件生成图片缩略图?
<%
Set Jpeg = Server.CreateObject("Persits.Jpeg")    '创建实例
Path = Server.MapPath("../images/apple.jpg")        '处理图片路径
Jpeg.Open Path                '打开图片
'调整宽度和高度为原来的50%
Jpeg.Width = Jpeg.OriginalWidth / 2
Jpeg.Height = Jpeg.OriginalHeight / 2
Jpeg.Save Server.MapPath("apple_small.jpg")        '保存图片到磁盘
Jpeg.Close:Set Jpeg = Nothing
%>
4、如何用AspJpeg组件生成图片水印?
<%
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open Server.MapPath("images/dodge_viper.jpg")
开始写文字
Jpeg.Canvas.Font.Color = &000000'' red 颜色
Jpeg.Canvas.Font.Family = "Courier New" 字体
Jpeg.Canvas.Font.Bold = True 是否加粗
Jpeg.Canvas.Print 10, 10, "Copyright (c) XYZ, Inc."
打印坐标x 打印坐标y 需要打印的字符
以下是对图片进行边框处理
Jpeg.Canvas.Pen.Color = &H000000'' black 颜色
Jpeg.Canvas.Pen.Width = 2 画笔宽度
Jpeg.Canvas.Brush.Solid = False 是否加粗处理
Jpeg.Canvas.Bar 1, 1, Jpeg.Width, Jpeg.Height
起始X坐标 起始Y坐标 输入长度 输入高度
Jpeg.Save Server.MapPath("images/dodge_viper_framed.jpg") 保存
%>
5、如何用AspJpeg组件进行图片合并?
AspJpeg 1.3+ enables you to place images on top of each other via the method DrawImage. To use this method, you must create two instances of the AspJpeg objects and populate both of them with images via calls to Open (or OpenBinary). When calling Canvas.DrawImage, the 2nd instance of AspJpeg is passed as an argument to this method, along with the X and Y offsets (in pixels):
使用该方法,您必需创建两个AspJpeg实例对象
<%
Set Jpeg1 = Server.CreateObject("Persits.Jpeg")
Set Jpeg2 = Server.CreateObject("Persits.Jpeg")
Jpeg1.Open Server.MapPath("t.jpg")
Jpeg2.Open Server.MapPath("t1.jpg")
Jpeg1.Canvas.DrawImage 10, 10, Jpeg2 ' optional arguments omitted
jpeg1.save Server.mappath("tt.jpg")
%>

本文来源:www.php18.com
6、如何用AspJpeg组件进行图片切割?
AspJpeg 1.1+ is also capable of cutting off edges from, or cropping, the resultant thumbnails via the method Crop(x0, y0, x1, y1). The size of the cropped image is specified by the coordinates of the upper-left and lower-right corners within the resultant thumbnail, not the original large image.
<%
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open Server.MapPath("t.jpg")
jpeg.Crop 20, 30, jpeg.Width - 20, jpeg.Height - 10
jpeg.save Server.mappath("tt.jpg")
Response.write("")
%>
7、如何用AspJpeg组件创建安全码?
创建安全码原理上和创建水印差不多。
<%
function make_randomize(max_len,w_n) 'max_len 生成长度,w_n:0 可能包含字母,1:只为数字
    randomize
    for intcounter=1 to max_len
        whatnext=int((1-0+1)*rnd+w_n)
        if whatnext=0 then
            upper=122
            lower=97
        else
            upper=57
            lower=48
        end if
        strnewpass=strnewpass & chr(int((upper-lower+1)*rnd)+lower)
    next
    make_randomize=strnewpass
end function

 

AspJpeg使用方法范例  2

'生成安全码的图片。
random_num=make_randomize(4,1) ''生成4位数字的安全码
session("random_num")=random_num '为么调用session,没有session的安全码是完全没有意义的。呵呵 .

Set Jpeg = Server.CreateObject("Persits.Jpeg") '调用组件
Jpeg.Open Server.MapPath("t.jpg") '打开准备的图片
Jpeg.Canvas.Font.Color = &HFFFFFF
Jpeg.Canvas.Font.Family = "Arial Black"
Jpeg.Canvas.Font.Bold = false
Jpeg.Canvas.PrintText 0, -2, random_num
jpeg.save Server.MapPath("tt.jpg") '保存
%>

12、如何让AspJpeg组件支援数据库?
图片存进数据库只能以二进制数据保存,这里即利用AspJpeg的Binary方法,下面以两个AspJpeg用户手册上的代码为例,具体请参考AspJpeg用户手册:
Opening Images from Memory
<% ' Using ADO, open database with an image blob
strConnect = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("../db/aspjpeg.mdb")
Set rs = Server.CreateObject("adodb.recordset")
SQL = "select image_blob from images2 where id = " & Request("id")
rs.Open SQL, strConnect, 1, 3
Set Jpeg = Server.CreateObject("Persits.Jpeg")
' Open image directly from recordset
Jpeg.OpenBinary rs("image_blob").Value
' Resize
jpeg.Width = Request("Width")
' Set new height, preserve original aspect ratio
jpeg.Height = jpeg.OriginalHeight * jpeg.Width / jpeg.OriginalWidth
Jpeg.SendBinary
rs.Close
%>
Output to Memory 
<%
...
Set rs = Server.CreateObject("adodb.recordset")
rs.Open "images", strConnect, 1, 3
rs.AddNew
rs("image_blob").Value = Jpeg.Binary
rs.Update
...
%>

AspJpeg使用方法范例  ASP教程 PHP易吧-- AspJpeg使用方法范例  ASP教程 PHP易吧-- 上传图片处理AspJpeg组件使用方法详解 PHP四十条优化网站的方法_IT牛吧---IT牛吧,PHP教程,ASP教程,Java教程,... PHPheader()函数常用举例—asp教程,php教程,ajax教程—网页吧 php教程 php中heredoc的使用方法 SQL Server 2000企业版安装教程,jsp,asp,sql,php,mysql,server,apache,iis,tomcat,oracle,java,linux,dns JAVA学习是一条漫长的道路,学网,教程,电脑教程,ASP教程,PHP教程,JSP教程,Flash教程,Photoshop教程,IT,软件教程,IT认证,网页设计教程,程序开发 php&mysql完整教程 用ASP实现论坛的UBB功能->>网页教学网(http://www.webjx.com)建站指南|网页制作|网页特效|Flash动画|网络编程|素材下载|教程下载|建站|HTML|CSS|JAVASCRIPT|ASP|PHP|JSP|ASP.NET|数据库 自己动手制作动态网站ASP.PHP.JSP 关于ASP/PHP/JSP未来发展方向 免费超大主机开放申请,支持 ASP.NET/ASP/php ASP留言本教程 Ant教程-详细使用方法 PHP100例 - PHP程序员站--PHP程序员之家 PHP新手教程 PHP高级技巧 P... Windows2003服务器安装及设置教程——软件安装与设置篇——ASPJPEG安装图解 最新asp/php/cgi免费空间信息大全 ASP、JSP、PHP 、Perl、.NET 等WEB开发语言比较 asp探针,php探针,jsp探针 - myz的专栏 - CSDNBlog ASP、JSP、PHP 、Perl、.NET 等WEB开发语言 ASP、JSP、PHP 三种技术比较 | 异次元软件世界 php通用分页类 - PHP程序员站--PHP程序员之家 PHP新手教程 PHP高级技巧 ...