troubleshooting Question

Scaling images on Upload where some are Landscape and some portrait

Avatar of rabbits2
rabbits2 asked on
Web DevelopmentASP
11 Comments1 Solution587 ViewsLast Modified:
How do to scale the images on upload, as some are landscape and some are portrait therefore I can not simply set the width to 200px as it would mean the portrait might be fine but the landscape at this dimension would be too narrow.
Just to show you what I do at present which contains no scaling or setting dimensions:
<!-- #include file="clsUpload.asp"-->
Dim objUpload
Dim lngFileID
Set objUpload = New clsUpload
function fileOnly(strFullPath)
     intIndex=InStrRev(strFullPath,"/")
     if intIndex >0 then
         fileOnly ="content/images/" &  Right(strFullPath,Len(strFullPath)-intIndex)
     else
       fileOnly ="content/images/" & strFullPath
    end if
end function

strFile = objUpload.Fields("File1").FileName
Set objField = objUpload("File1")
strFile2 = objUpload.Fields("File2").FileName
photoid=Request.QueryString("photoID")
strFileName = fileOnly(strFile)
strFileName2 = fileOnly(strFile2)

ad=objUpload("txt_picID").value
adid = fileOnly(ad)

str = objUpload("File1").FileName
str2 = objUpload("File2").FileName
strFileName1 = Left(str, InStrRev(str, ".") - 1) & "_" & ad & "." & Right(str, Len(str) - InStrRev(str, "."))
strFileName3 = Left(str2, InStrRev(str2, ".") - 1) & "_" & ad & "." & Right(str2, Len(str2) - InStrRev(str2, "."))
strPath = "D:/sites/piersmooreede.com/www.piersmooreede.com/web/content/images/" & strFileName1
strPath2 = "D:/sites/piersmooreede.com/www.piersmooreede.com/web/content/images/" & strFileName3
strdatabaseName1 = "images/" & strFileName1
strdatabaseName2 = "images/" & strFileName3
objUpload("File1").SaveAs strPath
objUpload("File2").SaveAs strPath2

And then I use an INSERT statement to save this filepath in my database.
ASKER CERTIFIED SOLUTION
_Stilgar_

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros