Sample code to resize an image with ASPJpeg

Sample code to resize an image with ASPJpeg 2.9.0.0.

You will need to customize the imagePath and image_name variables.  See comments in code.
 
<HTML> 
<HEAD> 
<TITLE>AspJpeg - Simple.asp</TITLE> 
</HEAD> 
<BODY> 
 
<
 
 ' Path and name to the location of the image file 
 imagePath = "/images" 
 image_name = "images.jpg" 
 
 ' Name of the resized image file 
 new_image_filename = "clock_small.jpg" 
 
 ' Create instance of AspJpeg 
 Set Jpeg = Server.CreateObject("Persits.Jpeg") 
  
 ' Compute path to source image 
 Path = Server.MapPath(imagePath & "/" & image_name) 
 
 ' Open source image 
 Jpeg.Open Path 
 
 ' Decrease image size by 50% 
 JpegJpeg.Width = Jpeg.OriginalWidth / 2 
 JpegJpeg.Height = Jpeg.OriginalHeight / 2 
 
 ' Apply sharpening if necessary 
 Jpeg.Sharpen 1, 130 
 
 ' create thumbnail and save it to disk 
 Jpeg.Save Server.MapPath(imagePath & "/" & new_image_filename) 
%> 
 
Original Image:<BR> 
<IMG SRC="<%=imagePath & "/" & image_name%>"><P
 
Thumbnail (50% reduction):<BR> 
<IMG SRC="<%=imagePath & "/" & new_image_filename%>"><P
 
<
 Response.Write "<HR>AspJpeg expires on " & Jpeg.Expires 
%> 
 
</BODY> 
</HTML> 


If you run in to problems using this code, please post in our community forum. Technical support cannot assist with specific coding related issues.