日期:2013-06-14  浏览次数:20958 次

AspJpeg 1.1 Programmer's Manual

Copyright (c) 2000 Persits Software, Inc.
All Rights Reserved.
This software is based in part on the work of the Independent JPEG Group (IJG)
What is AspJpeg?
AspJpeg is an active server component that creates resized versions of JPEG images. AspJpeg enables your ASP application to dynamically create high-quality thumbnails of images in just a few lines of code.
This component can be used in tandem with AspUpload, the leading file upload component from Persits Software, Inc., to create thumbnails of images as they are being uploaded.
System Requirements
Windows 95/98/NT/2000 and
IIS 4.0+ and ASP or
Visual Basic 5.0+ or
Visual C++ 5.0+ or
any development environment supporting COM.
Installation
The setup application aspjpeg.exe sets up 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
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
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 at the www.aspupload.com web site. 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.
Getting Started
The AspJpeg.exe[/b] setup application attempts to create the virtual directory /AspJpeg on top of the targetdir\Samples directory of the installation. Make sure it has been created successfully. If necessary, recreate it manually using File Explorer:
Right-click on the \Samples sub-directory underneath the target directory (typically it is c:\Program Files\Persits Software\AspJpeg unless otherwise specified), select Properties, open the Web Sharing tab, choose "Share this folder", type in AspJpeg under Alias. Click OK.
Also, if you installed AspJpeg on an NTFS drive, make sure the \Samples\images directory grants Everyone Full Control, or the sample ASP scripts will not be able to write to it. Using Windows Explorer, right-click on the directory targetdir\Samples\images, select Properties/Security, and if necessary, add the entry Everyone/Full Control.
Your First Thumbnail
To create a thumbnail of a JPEG image using AspJpeg, you should take the following simple steps:
  • Create an instance of the AspJpeg object via Server.CreateObject (or New if used in VB).
  • Open your image file via the Jpeg.Open method.
  • Set new image dimensions via the properties Jpeg.Width and Jpeg.Height. You may use read-only properties Jpeg.OriginalWidth and Jpeg.OriginalHeight to preserve the original width/height ratio.
  • Optional: You may include calls to any or all of the following methods: Jpeg.Sharpen to apply sharpening to the resultant thumbnail, Jpeg.Crop to crop it, Jpeg.FlipV and Jpeg.FlipH to flip an image vertically and/or horizontally.
  • Save the resultant thumbnail to disk via the Jpeg.Save method, or send it directly to the browser via the Jpeg.SendBinary met