Persits ASPJpeg Sample Code

Sample code to resize an image with ASPJpeg 1.6. User will need to customize the imagePath and image_name variables.  See comments in code.

Code Sample

 

                                                        
1 <HTML>
2 <HEAD>
3 <%
4 ' Path and name to the location of the image file
5 imagePath = "/images"
6 image_name = "clock.jpg"
7
8 ' Name of the resized image file
9 new_image_filename = "clock_small.jpg"
10
11 ' Create instance of AspJpeg
12 Set Jpeg = Server.CreateObject("Persits.Jpeg")
13
14 ' Compute path to source image
15 Path = Server.MapPath(imagePath & "/" & image_name)
16
17 ' Open source image
18 Jpeg.Open Path
19
20 ' Decrease image size by 50%
21 Jpeg.Width = Jpeg.OriginalWidth / 2
22 Jpeg.Height = Jpeg.OriginalHeight / 2
23
24 ' Apply sharpening if necessary
25 Jpeg.Sharpen 1, 130
26
27 ' create thumbnail and save it to disk
28 Jpeg.Save Server.MapPath(imagePath & "/" & new_image_filename)
29 %>
30
31 Original Image:<BR>
32 <IMG src="
  • 15 کاربر این را مفید یافتند
آیا این پاسخ به شما کمک کرد؟

مقالات مربوطه

Graphics Server .NET Information

Graphics Server .NET is an ASP.NET charting component that can be used to generate charts from...

Persits ASPJpeg Information

AspJpeg is a high-quality image thumbnail component that can resize images on-the-fly. Some...

Persits ASPUpload Information

ASPUpload enables an ASP application to capture, save and process files uploaded to the web...

WebSupergoo ABCpdf.NET Information

WebSupergoo ABCpdf.NET is an ASP.NET component that creates PDF files on the fly. WebSupergoo...

Sample Code for ASPPDF.NET

1 2 3 <%@ Assembly name="ABCpdf,...