Saludos a todos
He segudo el tutorial de hacer una foto con la librería Advance Camera y con el tutorial de FTP y la librería NET la envio por FTP a un directorio.
La imagen en el dispositivo android se ve perfectamente....pero al subirla por FTP...se ve verdosa, como si se hubiese estropeado.
Agradecería ayuda para saber porque sucede y como solventarlo.
Muchas gracias a todos
#Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#ApplicationLabel: Photo Clinica
#VersionCode: 1
#VersionName:
#SupportedOrientations: landscape
#End Region
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim ftp1 As FTP
End Sub
Sub Globals
Dim camera1 As AdvancedCamera
Dim btnTakePicture As Button
Private btnFlash As Button
Dim Panel1 As Panel
Dim paciente As String
Dim nfichero As String
Dim fecha As String
Dim dia As Int
Dim mes As Int
Dim año As Int
Dim hora As Int
Dim minutos As Int
Dim segundos As Int
Private txtbPaciente As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
End Sub
Sub Camera1_Ready (Success As Boolean)
If Success Then
camera1.StartPreview
btnTakePicture.Enabled = True
Else
ToastMessageShow("Imposible activar CAMARA", True)
End If
End Sub
Sub Activity_Resume
btnTakePicture.Enabled = False
camera1.Initialize(Panel1, "Camera1")
End Sub
Sub Activity_Pause (UserClosed As Boolean)
camera1.Release
End Sub
Sub Camera1_PictureTaken (Data() As Byte)
dia=DateTime.GetDayOfMonth (DateTime.Now)
mes=DateTime.GetMonth(DateTime.Now)
año=DateTime.GetYear(DateTime.now)
hora=DateTime.GetHour(DateTime.now)
minutos=DateTime.GetMinute(DateTime.now)
segundos=DateTime.GetSecond(DateTime.now)
fecha=dia & mes & año & "_" & hora & minutos & segundos
camera1.StartPreview
Dim out As OutputStream
nfichero="P" & fecha & ".png"
paciente="P" & txtbPaciente.text
out = File.OpenOutput(File.DirRootExternal, nfichero, False)
out.WriteBytes(Data, 0, Data.Length)
out.Close
ToastMessageShow("Image saved: " & File.Combine(File.DirRootExternal, nfichero), True)
btnTakePicture.Enabled = True
ftp1.Initialize("ftp1","host",21,"user","pass")
ftp1.UploadFile(File.DirRootExternal,nfichero,True,"/var/www/html/" & nfichero)
ftp1.Close
End Sub
Sub ftp1_UploadCompleted (ServerPath As String, Success As Boolean)
If Success=True Then
Msgbox("Carga Completada","")
Else
Msgbox("Carga Incompleta","")
End If
End Sub
Sub btnTakePicture_Click
If txtbPaciente.Text="0" Then
ToastMessageShow("Debe introducir un numero de Paciente", True)
Else
btnTakePicture.Enabled = False
camera1.FocusMode="AUTO"
camera1.TakePicture
End If
End Sub
Sub btnFlash_Click
Dim fl As String
fl=camera1.CurrentFlashMode
If fl= "off" Then
camera1.FlashOn
ToastMessageShow("Flash ON", True)
Else
camera1.FlashOff
ToastMessageShow("Flash OFF", True)
End If
End Sub
Sub Panel1_Click
camera1.FocusMode="AUTO"
End Sub
Sub txtbPaciente_TextChanged (Old As String, New As String)
paciente=txtbPaciente.Text
End Sub
He segudo el tutorial de hacer una foto con la librería Advance Camera y con el tutorial de FTP y la librería NET la envio por FTP a un directorio.
La imagen en el dispositivo android se ve perfectamente....pero al subirla por FTP...se ve verdosa, como si se hubiese estropeado.
Agradecería ayuda para saber porque sucede y como solventarlo.
Muchas gracias a todos
#Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#ApplicationLabel: Photo Clinica
#VersionCode: 1
#VersionName:
#SupportedOrientations: landscape
#End Region
'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim ftp1 As FTP
End Sub
Sub Globals
Dim camera1 As AdvancedCamera
Dim btnTakePicture As Button
Private btnFlash As Button
Dim Panel1 As Panel
Dim paciente As String
Dim nfichero As String
Dim fecha As String
Dim dia As Int
Dim mes As Int
Dim año As Int
Dim hora As Int
Dim minutos As Int
Dim segundos As Int
Private txtbPaciente As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
End Sub
Sub Camera1_Ready (Success As Boolean)
If Success Then
camera1.StartPreview
btnTakePicture.Enabled = True
Else
ToastMessageShow("Imposible activar CAMARA", True)
End If
End Sub
Sub Activity_Resume
btnTakePicture.Enabled = False
camera1.Initialize(Panel1, "Camera1")
End Sub
Sub Activity_Pause (UserClosed As Boolean)
camera1.Release
End Sub
Sub Camera1_PictureTaken (Data() As Byte)
dia=DateTime.GetDayOfMonth (DateTime.Now)
mes=DateTime.GetMonth(DateTime.Now)
año=DateTime.GetYear(DateTime.now)
hora=DateTime.GetHour(DateTime.now)
minutos=DateTime.GetMinute(DateTime.now)
segundos=DateTime.GetSecond(DateTime.now)
fecha=dia & mes & año & "_" & hora & minutos & segundos
camera1.StartPreview
Dim out As OutputStream
nfichero="P" & fecha & ".png"
paciente="P" & txtbPaciente.text
out = File.OpenOutput(File.DirRootExternal, nfichero, False)
out.WriteBytes(Data, 0, Data.Length)
out.Close
ToastMessageShow("Image saved: " & File.Combine(File.DirRootExternal, nfichero), True)
btnTakePicture.Enabled = True
ftp1.Initialize("ftp1","host",21,"user","pass")
ftp1.UploadFile(File.DirRootExternal,nfichero,True,"/var/www/html/" & nfichero)
ftp1.Close
End Sub
Sub ftp1_UploadCompleted (ServerPath As String, Success As Boolean)
If Success=True Then
Msgbox("Carga Completada","")
Else
Msgbox("Carga Incompleta","")
End If
End Sub
Sub btnTakePicture_Click
If txtbPaciente.Text="0" Then
ToastMessageShow("Debe introducir un numero de Paciente", True)
Else
btnTakePicture.Enabled = False
camera1.FocusMode="AUTO"
camera1.TakePicture
End If
End Sub
Sub btnFlash_Click
Dim fl As String
fl=camera1.CurrentFlashMode
If fl= "off" Then
camera1.FlashOn
ToastMessageShow("Flash ON", True)
Else
camera1.FlashOff
ToastMessageShow("Flash OFF", True)
End If
End Sub
Sub Panel1_Click
camera1.FocusMode="AUTO"
End Sub
Sub txtbPaciente_TextChanged (Old As String, New As String)
paciente=txtbPaciente.Text
End Sub
Last edited: