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>  | 
        
    
  
                        
                        Article ID: 184, Created: August 6, 2012 at 11:38 PM, Modified: August 6, 2012 at 11:38 PM