Hi there,
I have an image uploaded on the website, and I want to generate width and height automatically from a given values(image values in cm).
Ex:
' Image values in cm
Dim strInal as string = 140
Dim strLati as string = 90
Dim strRatio As String
Dim cnstInaltime As Integer
Dim cnstLatime As Integer
' checking to see the image format
If strInal.ToString > strLati.ToString Then
strRatio = Math.Round(strInal / strLati)
cnstInaltime = 15
cnstLatime = 10 * strRatio
End If
If strInal.ToString = strLati.ToString Then
strRatio = 1
cnstInaltime = 5
cnstLatime = 5
End If
If strLati.ToString > strInal.ToString Then
strRatio = Math.Round(strLati / strInal)
cnstInaltime = 10 * strRatio
cnstLatime = 15
End If
Dim intA As Integer = strInal
Dim intB As Integer = strLati
' generating the values in decreasing way
While (intA > 15 Or intB > 15)
intA -= cnstInaltime
intB -= cnstLatime
End While
The code above cannot keep aspect ratio. Can someone help me?
Thanks
I have an image uploaded on the website, and I want to generate width and height automatically from a given values(image values in cm).
Ex:
' Image values in cm
Dim strInal as string = 140
Dim strLati as string = 90
Dim strRatio As String
Dim cnstInaltime As Integer
Dim cnstLatime As Integer
' checking to see the image format
If strInal.ToString > strLati.ToString Then
strRatio = Math.Round(strInal / strLati)
cnstInaltime = 15
cnstLatime = 10 * strRatio
End If
If strInal.ToString = strLati.ToString Then
strRatio = 1
cnstInaltime = 5
cnstLatime = 5
End If
If strLati.ToString > strInal.ToString Then
strRatio = Math.Round(strLati / strInal)
cnstInaltime = 10 * strRatio
cnstLatime = 15
End If
Dim intA As Integer = strInal
Dim intB As Integer = strLati
' generating the values in decreasing way
While (intA > 15 Or intB > 15)
intA -= cnstInaltime
intB -= cnstLatime
End While
The code above cannot keep aspect ratio. Can someone help me?
Thanks