|
|
|
ลดขนาดรูปเขาทำกันยังไงเหรอครับ จะลดขนาดของรูปเมื่อมีการโหลตเว็บไซต์ เพื่อลดปริมาณ Data Trafer ครับ |
|
|
|
|
|
|
|
Code (AspResizeImages.asp)
<%
Option Explicit
Dim Chs, objConst,NewWidth,NewHeight
Dim FileName,OutFormat
FileName = "mygirl.jpg"
OutFormat = "Jpg" '*** Gif,Png ***'
NewWidth = "100" '*** Set new Width , Height automatic caculate ***'
NewHeight = 0 '*** Auto Resize ***'
'*** Get Images Width & Height ***'
Dim objFso,myImg,Width,Height
Set objFso = CreateObject("Scripting.FileSystemObject")
IF objFso.FileExists(Server.MapPath(FileName)) Then
set myImg = Loadpicture(Server.MapPath(FileName))
Width = Round(myImg.width / 26.4583)
Height = Round(myImg.height / 26.4583)
NewHeight = Round((NewWidth*Height)/Width)
'NewHeight = 100
'NewWidth = Round((NewHeight*Width)/Height) '*** or Automatic Height ***'
End If
'*************** End *************'
Set Chs = Server.CreateObject("OWC10.ChartSpace")
Set objConst = Chs.Constants
Chs.Interior.SetTextured Server.MapPath(FileName), objConst.chStretchPlot, , objConst.chAllFaces
Chs.border.color = -3
Response.BinaryWrite Chs.GetPicture(OutFormat, NewWidth, NewHeight)
Set objConst = Nothing
Set Chs = Nothing
%>
Code (ASPViewResizeImages.asp)
<% Option Explicit %>
<html>
<head>
<title>ThaiCreate.Com ASP Resize Images</title>
</head>
<body>
<b>Oritial Size</b><br>
<img src="mygirl.jpg">
<hr>
<b>New Size</b>
<br>
<img src="AspResizeImages.asp">
</body>
</html>
|
|
|
|
|
Date :
2009-04-25 09:19:31 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|