[RESOLVED] image gallery position (vertical,horizontal)
When load images with mixed positions and have to resize images in format relation -> first image take y-x (portrait) relation but it isnt correct ...
Here is the code :
Private Sub resizeBiggerImages(ByVal sFolder As String, ByVal dFolder As String, _
ByVal x As Integer, ByVal y As Integer)
Dim i As Integer
fNames = My.Computer.FileSystem.GetFiles(sFolder)
'Get the number of elements from systemCollection
For i = 0 To fNames.Count - 1
If (iSourceImage.Width < iSourceImage.Height) Then
fName = dFolder & "\" & fNames(i).ToString().Substring(fNames(i).ToString().LastIndexOf("\"))
'creates image from specified file
iSourceImage = Image.FromFile(fNames(i).ToString())
'set dppi
iSourceImage.SetResolution(96, 96)
If fName.EndsWith(".jpg") Then
think.ResizePhoto1(iSourceImage, New Size(x, y)).Save(fName, System.Drawing.Imaging.ImageFormat.Jpeg)
ElseIf fName.EndsWith(".gif") Then
think.ResizePhoto1(iSourceImage, New Size(x, y)).Save(fName, System.Drawing.Imaging.ImageFormat.Gif)
ElseIf fName.EndsWith(".bmp") Then
think.ResizePhoto1(iSourceImage, New Size(x, y)).Save(fName, System.Drawing.Imaging.ImageFormat.Bmp)
End If
Else
'giving last information of specified string,retrives part of string
fName = dFolder & "\" & fNames(i).ToString().Substring(fNames(i).ToString().LastIndexOf("\"))
'creates image from specified file
iSourceImage = Image.FromFile(fNames(i).ToString())
'set dppi
iSourceImage.SetResolution(96, 96)
'calling the function for resizing photo
If fName.EndsWith(".jpg") Then
think.ResizePhoto(iSourceImage, New Size(x, y)).Save(fName, System.Drawing.Imaging.ImageFormat.Jpeg)
ElseIf fName.EndsWith(".gif") Then
think.ResizePhoto(iSourceImage, New Size(x, y)).Save(fName, System.Drawing.Imaging.ImageFormat.Gif)
ElseIf fName.EndsWith(".bmp") Then
think.ResizePhoto(iSourceImage, New Size(x, y)).Save(fName, System.Drawing.Imaging.ImageFormat.Bmp)
End If
End If
Next
End Sub
:bigyello: