AspJpeg
AspJpeg 1.1 Programmer ' s Manual
Copyright (c) Persits Software, Inc.
All Rights Reserved.
This software was based in the work of the Independent JPEG Group (IJG)
What is AspJpeg?
AspJpeg is a 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 of code.
This component can is used in tandem with AspUpload, the leading file upload component from Persits, Inc., to Software Ate 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.exeSets up and registers the AspJpeg component along with documentation and samples of your choice. To install AspJpeg on another computer, it's sufficient to copy the file
Aspjpeg.dllTo the other system and register it there using the
regsvr32command-line utility as follows:
C:\>
regsvr32 c:\path\aspjpeg.dll
If that machine is already running a older version of the component, you should shut down and restart the IIS services T o 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 a few days, the component'll start throwing an expiration error unless/until a registration key is installed. A Registration key can is 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 is shut down.
Getting Started
the aspjpeg.exe[/b] Setup application attempts to create the virtual directory
/aspjpeg in top of T He
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 the tar Get directory (typically it is c:\Program files\persits software\aspjpeg unless otherwise), select Properties, O Pen The Web sharing tab, choose "Share this Folder" and type in
AspJpeg under Alias. Click OK.
Also, if you are installed AspJpeg on a NTFS drive, make sure the
\samples\images directory grants
Everyone Full Control, or the sample ASP scripts won't is 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-Thumbnail
To create a thumbnail of a JPEG image using AspJpeg, your 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 could use Read-only properties jpeg.originalwidth and jpeg.originalheight to preserve the original wid Th/height ratio.
- Optional: You could include calls to or 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 ima GE 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 method.
The code sample http://localhost/aspjpeg/simple.asp demonstrates this procedure on the sample image
clock.jpgLocated in the
\imagesSub-Folder.
This is the underlying ASP script:
<%' Create instance of AspJpeg
Set Jpeg = Server.CreateObject ("Persits.jpeg")
' Compute path to source image
Path = Server.MapPath ("Images") & "\clock.jpg"
' Open source image
Jpeg.open Path
' Decrease image size by 50%
Jpeg.width = JPEG.ORIGINALWIDTH/2
Jpeg.height = JPEG.ORIGINALHEIGHT/2
' Apply sharpening if necessary
' Jpeg.sharpen 1, 130
' Create thumbnail and save it to disk
Jpeg.save Server.MapPath ("Images") & "\clock_small.jpg"
%>
<p>