image question

R

Ray at

Decrease the height by the same percentage.

iCurrentWidth = 100
iCurrentHeight = 54
iDesiredWidth = 70
iPercentDecreased = iDesiredWidth/iCurrentWidth
iNewHeight = CInt(iCurrentHeight * iPercentDecreased)

Ray at work
 
G

Gonzosez

How do I determine the orginal size?
Ray at said:
Decrease the height by the same percentage.

iCurrentWidth = 100
iCurrentHeight = 54
iDesiredWidth = 70
iPercentDecreased = iDesiredWidth/iCurrentWidth
iNewHeight = CInt(iCurrentHeight * iPercentDecreased)

Ray at work
 
R

Roland Hall

:
: How do I determine the orginal size?

You can do it on the client-side.

This will not be the way you will want to use it but it will contain all the
elements to convert it for your needs.
Click on the image link and it will create a new image based on the defined
'width', passed as an argument. I am passing 40 for the first image and 200
for the second. If all images need a fixed width, then just set that in
your function. I have it commented out right now in mine.

http://kiddanger.com/lab/imgsize.html

HTH...

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 
W

William Morris

Not so! Don't remember where I found this but if you're using IIS 5.0 this
ought to work...(at least, it does for me)

Function GetScaledImageDimensions(strPicturePath, imgWidth, imgHeight)
dim picture, actualWidth, actualHeight, decProportion
'--- as inputs, imgWidth and imgHeight are used as target sizes.
'--- if imgWidth > 0 then imgHeight is adjusted proportionately, and vice
versa.
'--- to return the actual width and height, leave both at zero
On Error Resume Next
Set Picture = LoadPicture(strPicturePath)
If Err <> 0 Then
imgWidth = 0
imgHeight = 0
Else
actualWidth = Round(Picture.Width / 26.5)
actualHeight = Round(Picture.Height / 26.5)
if imgWidth > 0 and imgHeight = 0 then
decProportion = imgWidth / actualWidth
elseif imgWidth = 0 and imgHeight > 0 then
decProportion = imgHeight / actualHeight
else
decProportion = 1
end if
imgWidth = Round(actualWidth * decProportion)
imgHeight = Round(actualHeight * decProportion)
End If
Set Picture = nothing
End Function
 
R

Ray at

Oops. :]

Ray at work

William Morris said:
Not so! Don't remember where I found this but if you're using IIS 5.0 this
ought to work...(at least, it does for me)

Function GetScaledImageDimensions(strPicturePath, imgWidth, imgHeight)
dim picture, actualWidth, actualHeight, decProportion
'--- as inputs, imgWidth and imgHeight are used as target sizes.
'--- if imgWidth > 0 then imgHeight is adjusted proportionately, and vice
versa.
'--- to return the actual width and height, leave both at zero
On Error Resume Next
Set Picture = LoadPicture(strPicturePath)
If Err <> 0 Then
imgWidth = 0
imgHeight = 0
Else
actualWidth = Round(Picture.Width / 26.5)
actualHeight = Round(Picture.Height / 26.5)
if imgWidth > 0 and imgHeight = 0 then
decProportion = imgWidth / actualWidth
elseif imgWidth = 0 and imgHeight > 0 then
decProportion = imgHeight / actualHeight
else
decProportion = 1
end if
imgWidth = Round(actualWidth * decProportion)
imgHeight = Round(actualHeight * decProportion)
End If
Set Picture = nothing
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top