%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
option explicit
%>
Untitled Document
<%
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
dim Upload, f
dim originalNameFile, renameFile, thumbAuto, createThumb, x
Set Upload = New FreeASPUpload
'faz o upload da imagem para a pasta temporária
Upload.Save(Server.MapPath(".")&"\imagens\temp\")
'originalNameFile = Upload.UploadedFiles("imagem").FileName
thumbAuto = upload.form("thumbAuto")
For Each f In upload.UploadedFiles.Items
originalNameFile = f.FileName
'define o novo nome do arquivo
renameFile = Session.SessionID & ".jpg"&f.ext
set x = new clsImage
'verifica se é ou não para criar o thumb automatico
if thumbAuto="1" then
thumbAuto = false
createThumb = false
else
thumbAuto = true
createThumb = true
end if
'força o redimensionamento da imagem principal e salva na pasta
x.originalNameFile = originalNameFile
x.imagePath = Server.MapPath(".")&"\imagens\"
x.newNameFile = renameFile
x.createThumb = createThumb
x.thumbAuto = thumbAuto
x.resizeImage
set x = nothing
set x = new clsImage
'força o redimensionamento da imagem principal e salva na pasta com nova dimensão
x.originalNameFile = renameFile
x.imagePath = Server.MapPath(".")&"\imagens\150X100\"
x.tempPath = Server.MapPath(".")&"\imagens\"
x.newNameFile = renameFile
x.maxH = 150
x.maxW = 100
x.createThumb = false
x.thumbAuto = false
x.deleteOriginalFile = false
x.resizeImage
set x = nothing
if thumbAuto = false then
Response.Write("_")
Response.End()
else
response.write ""
Response.End()
end if
next
set Upload = nothing
end if
%>
<%
if Request.QueryString("preview")<>"" then
%>
Imagem Redimensionada:
" />
Imagem Thumb:
" />
<%
end if
%>