这是最新一篇日志上一篇 | 下一篇

AspJpeg用户手册 第一章01

| 分类: 外文翻译 订阅所有外文翻译的日志

第一章:引言和快速上手Chapter 1:Introduction & Quick Start

1.1 什么是AspJpeg? What is AspJpeg?

AspJpeg 是一种在Microsoft IIS环境中使用的高级图像处理组件。AspJpeg is an advanced image management component to be used in a Microsoft IIS environmemt.

AspJpeg能够使你的ASP/ASP.net应用程序仅仅用若干行代码就动态生成高质量的缩略图。原图可以是以下格式的:JPEG、GIF、BMP、TIFF 或者 PNG.AspJpeg enables you ASP/ASP.net application to dynamically create high-quality thumbnails of images in just a few lines of code. An original image may be in any of the following formats: JPEG,GIF,BMP,TIFF or PNG.

这个组件能够与AspUpload组件合起来用,生成被上传到Web服务器的图片的缩略图。AspUload是Persits软件公司出品的一款优秀上传组件。This component can be used in tandem with AspUpload, the leading file upload component from Persits Software, Inc., to create thumbnuails of images as they are being uploaded to the Web server.

1.2 软件的一般特点Feature Summary

  • 支持JPEG、GIF、BMP、TIFF 以及PNG格式,生成的图片的格式则全部为JPEG.Supports JPEG,GIF,BMP,TIFF, and PNG formats. Output format is always JPEG.
  • 源图能够直接从本地磁盘上打开Source images can be opened from disk
  • 转换后的图像能够保存到本地磁盘上、内存里或者以HTTP数据流形式发送Resized images can be saved to disk, memory or an HTTP stream.
  • 支持三种重分配图像象素的运算法则:邻近、两次线性、两次立方Supports three resizing algorithms: nearest-neighbor, bilinear, and bicubic.
  • 可以在图片上画一些内容或者写一些字符Drawing and typing on top of an image.
  • 支持画中画Picture-in-picture support.
  • 支持剪裁、翻转、旋转、锐化、灰度转换效果。Cropping, flipping, rotation, sharpening, grayscale conversion.
  • 输出的图像压缩率能够在最高/最佳/最省几个级率中选择Compression rate of output images can be adjusted for optimal quality/file size ratio.
  • 支持从JPEG图片中读出它的EXIF数据和IPTC数据。EXIF and IPTC metadata extraction from JPEG images.

1.3 系统要求System Requirements

Windows 95/98/NT/2000/XP/2003操作系统,IIS 4.0以上版本,ASP或者ASP.NET或者VB5.0以上版本或者VC++ 5.0以上开发环境,或者任何支持COM的开发环境。 Windows 95/98/NT/2000/XP/2003, and IIS 4.0+ and ASP/ASP.NET, or Visual Basic 5.0+, or Visual C++ 5.0+, or any development environment supporting COM.

1.4 安装配置Installation

安装好aspjpeg.exe应用程序安装包,并注册AspJpeg。如果以后把AspJpeg安装到另一台电脑上,必须把aspjpeg.dll拷贝到另一个系统中,并再次在那里注册它,用以下32位命令行:The setup application aspjpeg.exe installs and registers the AspJpeg component along with documentation and samples in a directory of your choice. To install AspJpeg on another computer, it is sufficient to copy the file aspjpeg.dll to the other system and register it there using the regsvr32 command-line utility as follows:

c:\>regsvr32

c:\path\aspjpeg.dll

如果机器上已经运行着一个旧的版本的组件,你必须停掉并重启IIS服务器来从内存中卸载旧版本的动态链接库。用以下命令停掉再重启IIS服务器 If that machine was already running an older version of the component, you should shut down and restart the IIS services to remove the old version of the DLL from memory, as follows:

c:\>net stop iisadmin /y

c:\>net start w3svc

AspJpeg组件的安装程序提供30天的免费试用评估期,这个试用评估版本是功能完整的,没有任何限制和禁用。30天以后,这个组件将不能使用,除非提供一个有效的注册码。购买注册码请来这里:http://www.aspjpeg.com/download.html。获得一个注册码之后,你可以把它放进系统注册表中,不需要重装这个组件。你的Web服务器也不需要重启。 The setup installs a 30-day evaluation copy of the AspJpeg component. The evaluation version is fully functional, i.e. no features are disabled or limited. After 30 days, the component will start throwing an expiration error unless/until a registration key is installed. A registration key can be purchased here. Once a key is obtained, you can import it into the system registry without re-installing the component. Your web server does not need to be shut down.

我们强烈建议sample目录使用NTFS的文件系统来避免“存取被禁止”或者其它的在运行代码时产生的错误。使用Windows资源管理器,右击c:\Program Files\Persits Software\AspJpeg\Samples目录,选择“属性”菜单项,在弹出的对话框中选择“安全”,中给“Everyone”完全控制的权限。点击“高级”按钮,确保“设置该许可给所有子文件夹”的勾选框被构上,然后再继续做。 It is strongly recommended that NTFS permissions be adjusted on the \Samples directory and all subdirectories to avoid an "Access is denied" or other errors when running the code samples. Using Windows Explorer, right-click on the directory c:\Program Files\Persits Software\AspJpeg\Samples, select the Security tab and give the "Everyone" account full control over this folder. Click "Advanced..." and make sure the checkbox "Reset permissions on all child objects..." is checked, as follows:

C:\Program Files\Persits Software\AspUpload\Samples文件夹安全属性

C:\Program Files\Persits Software\AspUpload\Samples高级安全设置

1.5 期满机制Expiration Mechanism

就如同其它的Persits软件组件一样,AspJpeg用了一个基于注册码的终止机制。当一个产品的拷贝被购买后,注册码会通过邮件发给顾客。 Like other Persits Software components such as AspUpload and AspEmail, AspJpeg uses a registration key-based expiration mechanism. Once a copy of the product is purchased, the registration key is sent to the customer via email.

当你获得注册码后,它必须被注入到系统注册表的HKEY_LOCAL_MACHINE\Software\Persits Software\AspJpeg\RegKey项中,为作一个默认值。AspJpeg.exe安装程序可以自动地把这个注册码放到注册表中,你也可以选择手动地添加它到注册表 Once the key is obtained, it should be installed in the system registry under the location HKEY_LOCAL_MACHINE\Software\Persits Software\AspJpeg\RegKey as a default value. The AspJpeg.exe installer will place the key in this registry location automatically, or you may choose to do it manually using regedit.

作为另一种供选方法,注册码也可以沿用以下方法,通过代码写入AspJpeg组件的顶级属性RegKey的值的方法来设定:Alternatively, the registration key can be specified in your code via the RegKey property of the top-level ASPJpeg object, as follows:

Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.RegKey = "12345-67890-12345"
...

照以下方法通过组件的Expries属性可以读出该组件的有效期限The current expiration date of the component can be retrieved via the Expires property, as follows:

Set Jpeg = Server.CreateObject("Persits.Jpeg")
Response.Write Jpeg.Expires

如果该属性返回9999-9-9 就意味着已经得到了一个永久使用的授权。If this property returns 9/9/9999 it means a permanent registration key is being used.

1.6 快速上手Quick Start

下面的这段代码从硬盘上打开一个图片,然后生成它的一个50%大小的缩略图: The following code sample opens an image from disk and creates a 50% scaled-down thumbnail of the image:

VB Script:

<% ' Create instance of AspJpeg
Set Jpeg = Server.CreateObject("Persits.Jpeg")
' Compute path to source image
Path = Server.MapPath("../images/apple.jpg")

' Open source image
Jpeg.Open Path

' Decrease image size by 50%
Jpeg.Width = Jpeg.OriginalWidth / 2
Jpeg.Height = Jpeg.OriginalHeight / 2

' create thumbnail and save it to disk
Jpeg.Save Server.MapPath("apple_small.jpg")
%>

C#:

<script runat="server" LANGUAGE="C#">
void Page_Load(Object Source, EventArgs E)
{
ASPJPEGLib.IASPJpeg objJpeg;
objJpeg = new ASPJPEGLib.ASPJpeg();

// Compute path to source image
String strPath = Server.MapPath("../images/apple.jpg");

// Open source image
objJpeg.Open( strPath );

// Decrease image size by 50%
objJpeg.Width = objJpeg.OriginalWidth / 2;
objJpeg.Height = objJpeg.OriginalHeight / 2;

// Create thumbnail and save it to disk
objJpeg.Save( Server.MapPath("clock_small.jpg" ) );

originalImage.Src = "apple.jpg";
SmallImage.Src = "apple_small.jpg";
}

</script>

点击以下链接来运行这些样例代码:Click the links below to run this code sample:

http://localhost/aspjpeg/manual_01/01_quickstart.asp

http://localhost/aspjpeg/manual_01/01_quickstart.aspx

第二章:生成缩略图Creating Thunbnails




[本日志由 fanxiaojie 于 2009-03-29 01:31 PM 编辑]
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: persits.jpeg使用手册
评论: 3 | 引用: 0 | 查看次数: 1351
回复回复稽山草[2008-10-29 09:14 AM| 第1楼 | 编辑 | 高级编辑 | 删除]
提供一个AspJpeg组件的破解版下载:点此下载该RAR文件。 IIS的网站默认安装目录是在C:\Inetpub\wwwroot中,但是我的一般做法是把默认安装目录改到E:\wwwroot里。AspJpeg安装好之后,AspJpeg Sample的默认安装目录是在C:\Program Files\Persits software\AspJpeg\Sample里,它会自动在IIS网站-默认网站的根目录下创建一个名为aspjpeg的虚拟目录。如果你用的是Windows XP professional操作系统,安装好AspJpeg组件之后,把这个C:\Program Files\Persits Software\AspJpeg\Sample中的内容挪到E:\wwwroot\persits\aspjpeg目录下,然后把IIS默认网站的根目录下的aspjpeg虚拟目录的本地路径改成E:\wwwroot\persits\aspjpeg,然后刷新一下,就可以访问http://localhost/aspjpeg/manual_01/01_quickstart.asp这个地址了。
回复回复稽山草[2008-10-29 09:28 AM| 第2楼 | 编辑 | 高级编辑 | 删除]
如果你用的是Windows server 2003操作系统,你还必须在默认网站的主目录中加入写入权限,并在本地目录的安装属性上如上设置(Windows xp professional没有安装属性这一项。)打开IIS默认网站属性的ASP.net选项卡,把ASP.net改为2.0以上版本(默认是1.1的版本),确认刷新一下,则你也能够访问http://localhost/aspjpeg/manual_01/01_quickstart.aspx这个地址了。
回复回复fanxiaojie[2009-07-02 10:22 AM| 第3楼 | 编辑 | 高级编辑 | 删除]

关于到期后注册asp.jpeg,据说只要把下面这段内容保存为.reg文件然后注入注册表就好了:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Persits Software\AspJpeg\RegKey] @="48958-77556-02411"
发表评论
本站不欢迎游客针对博客文章发表评论,留言请点此