ASP image upload with aspjpeg automatically generate thumbnails

Source: Internet
Author: User

AspJpeg feature Settings

Set Jpeg = Server.CreateObject ("Persits.jpeg")


' Get Source picture path

Path = Server.MapPath ("uploadimages/") & "/" &filename


' Open the source picture
Jpeg.open Path
' Create thumbnail details There are a number of ways to set this up. The following method is to determine the aspect ratio and then scale

If jpeg.originalwidth/jpeg.originalheight > 1 Then
Jpeg.width = 98
jpeg.height = Int ((98/jpeg.originalwidth) *jpeg.originalheight)
ElseIf
Jpeg.originalwidth/jpeg.originalheight < 1 Then
Jpeg.height = 98
jpeg.width= Int (jpeg.originalwidth* (98/jpeg.height))
End If


' Set sharpening effect

Jpeg.sharpen 1, 130


' Generate thumbnails to the specified path

jpeg.save Server.MapPath ("uploadimages/") & "/small" &filename

' Note that these two sessions

Session ("PPP0") =gp_curpath&filename
Session ("PPP1") =gp_curpath& "small" &filename


Simpler generation of thumbnails

Set Jpeg = Server.CreateObject ("persits.jpeg") ' Create instance
Path = Server.MapPath (Blogpath & "/upload/" & FileName) ' Process picture path
Jpeg.open Path ' Open picture


' Adjust width and height to the original 50%, or you can write a fixed number of digits directly

jpeg.width = JPEG.ORIGINALWIDTH/2
Jpeg.height = JPEG.ORIGINALHEIGHT/2
Jpeg.save Server.MapPath (Blogpath & "/upload/" & FileName) ' Save pictures to disk
Jpeg.Close:Set Jpeg =
Nothing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.