오늘 저는 Webmaster 웹 사이트에서 Netizen이 쓴 사진 앨범 프로그램을 보았습니다. 기능은 매우 간단했습니다. 그가 ASPJPEG를 사용하여 썸네일을 생성하는 것을 보았을 때, 그는 AspuPload를 사용하여 업로드하는 것을 생각할 수 없었기 때문에 코드를 완성하기 위해 한 시간을 보냈습니다.
다음 모든 코드에는 간단한 의견이 제공됩니다. 이해할 수 없다면 Aspjpeg 및 Aspupload에 대한 지침을 먼저 읽으십시오 (e- 텍스트, 정신적으로 준비되기를 바랍니다). 이해하지 못하면 저에게 물어볼 수 있습니다.
코드는 다음과 같습니다.
코드 사본은 다음과 같습니다.
<%
ifsession ( "admin") <> "on"그런 다음
response.redirect "login.asp"
endif
%>
<!-#includefile = "config.asp"->
<!-#includefile = "mdb/conn.asp"->
<%
setupload = server.createobject ( "persits.upload")
filepath = server.mappath ( ".")
count = upload.save (filepath & bigphotopath) '큰 이미지 전송
smallfilepath = filepath & smallphotopath
foreachfileinupload.files
setjpeg = server.createobject ( "persits.jpeg")
jpeg.open (file.path)
bigfp = bigphotopath & (file.filename) '큰 이미지 상대 경로
sfp = smallphotopath & "s _"& (file.filename) '작은 그림 상대 경로
filesize = file.size '는 데이터베이스에 쓸 준비가되었습니다
'어느 쪽이 긴면인지 결정을 시작하고, 긴면으로 규모를 유지하고, 작은 그림을 생성하십시오.
imgwidth = jpeg.originalWidth
imgheight = jpeg.originalheight
ifimgwidth> = imgheightandimgwidth> 120then
jpeg.width = 150
jpeg.height = jpeg.originalheight/(jpeg.originalwidth/150)
endif
ifimgheight> imgwidthandimgheight> 113then
jpeg.height = 113
jpeg.width = jpeg.originalwidth/(jpeg.originalheight/113)
endif
JPEG.SHARPEN1,130
jpeg.save (smallfilepath & "s _"& file.filename)
'큰 이미지에 워터 마크를 추가하십시오 (큰 이미지에 워터 마크를 추가)
jpeg.openserver.mappath ( "& bigfp &" ")
jpeg.canvas.font.color = & hff0000
jpeg.canvas.font.family = "Couriernew"
jpeg.canvas.pen.color = & h000000
jpeg.canvas.pen.width = 2
jpeg.canvas.brush.solid = false
jpeg.canvas.font.bkmode = "opaque" '는 스무딩을 처리합니다
jpeg.canvas.printtext10,10, "www.luanluan.cn"
'JPEG.CANVAS.DRADBAR1,1,100,100
jpeg.saveserver.mappath (bigfp)
다음
strsql = "insertIntodesktop ([name], typeid, zhuanti, jj, [time], imgh, imgw, filesize, url, surl) 값 ( '" "& upload.form ("name ") &"', ' "& upload.form ("typeid ") & " ','"& upload.form ( "Zhuanti") & " ','"& upload.form ( "photointro") & " '', '"& now () & "', '" "& imgheight &"', ' "& imgwidth &"', ' "& files size &"' ',' "& bigfp &" ' "" "' '' ').