Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > ASP > ASP Image > ASP Upload and Resize Image



Clound SSD Virtual Server

ASP Upload and Resize Image

ASP Upload and Resize Image เป็นการเขียน ASP Form Upload และทำการ Resize Image ในรูปแบบของ Thumbnails


ASP aspSmartUpload



Syntax

Server.CreateObject("OWC10.ChartSpace")



AspUploadResize.html

<html>
<head>
<title>ThaiCreate.Com ASP  & Upload and Resize</title>
</head>
<body>
<form action="AspUploadResize.asp" method="post" enctype="multipart/form-data" name="frmMain">
Upload 
<input name="file1" type="file">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>


AspUploadResize.asp

<%Option Explicit%>
<html>
<head>
<title>ThaiCreate.Com ASP  & Upload and Resize</title>
</head>
<body>
<%
	Dim sFileName,strPath
	Dim mySmartUpload
	
	strPath = "MyResize"

	'*** Upload By aspSmartUpload ***'

	'*** Create Object ***'	
	Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

	'*** Upload Files ***'
	mySmartUpload.Upload

	'** Getfile Name ***'
	sFileName = mySmartUpload.Files("file1").FileName

	If sFileName <> "" Then
		'*** Upload **'
		mySmartUpload.Files("file1").SaveAs(Server.MapPath(strPath&"/"&sFileName))
		
		'********* Resize Images *******'
		Response.write("<b>Oritial Size</b><br><img src=MyResize/"&sFileName&"><hr>")
		Response.write("<b>New Size</b>")

		Dim Chs, objConst,NewWidth,NewHeight
		Dim OutFormat,OutFileName
		OutFormat = "Jpg" '*** Gif,Png ***'
		OutFileName = "Thumbnails_"&sFileName
		NewWidth = "100" '*** Set new Width , Height automatic caculate ***'
		NewHeight = 0 '*** Auto Resize ***'
		 
		'*** Get Images Width & Height ***'
		Dim objFso,myImg,Width,Height
		Set objFso = Server.CreateObject("Scripting.FileSystemObject")
		IF objFso.FileExists(Server.MapPath(strPath&"/"&sFileName))  Then	
			set myImg = Loadpicture(Server.MapPath(strPath&"/"&sFileName))
			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(strPath&"/"&sFileName), objConst.chStretchPlot, , objConst.chAllFaces  
		Chs.border.color = -3  

	   'Chs.border.color = &H0000FF  
	   'Chs.border.Weight = 3  

		Chs.ExportPicture Server.MapPath(strPath&"/"&OutFileName),OutFormat,NewWidth,NewHeight
		
		Set objConst = Nothing
		Set Chs = Nothing
		Response.write("<br><img src="&strPath&"/"&OutFileName&">")
		'***** End  Resize Images ******'	
	End IF
%>
</table>
</body>
</html>

Screenshot

ASP & Upload Resize

ASP & Upload Resize

ASP & Upload Resize






   
Share


ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท


ลองใช้ค้นหาข้อมูล


   


Bookmark.   
       
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rating :  
  Create/Update Date : 2008-08-10 17:14:24 / 2009-02-01 09:26:58
  Download : Download  ASP Upload and Resize Image
 Sponsored Links / Related

 
ASP Create Image
Rating :

 
ASP Write Text in Image
Rating :

 
ASP Resize Image
Rating :

 
ASP Resize Image and Insert to Database
Rating :


ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่