This app save each image into a server via FTP
and if you want download all images to merge into a video
Esta App salva cada imagen en un servidor via FTP
y si lo deseas puedes bajar todas las imágenes para unirlas en un video.
and if you want download all images to merge into a video
Esta App salva cada imagen en un servidor via FTP
y si lo deseas puedes bajar todas las imágenes para unirlas en un video.
B4X:
#Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#ApplicationLabel: PhotoShot
#VersionCode: 1
#VersionName:
#SupportedOrientations: landscape
#End Region
'Activity module
'saca una foto cada 30 segundos
Sub Process_Globals
Dim connectiontimer As Timer
' 30000 es igual a 30 segundos
connectiontimer.Initialize("connectiontimer",10000)
connectiontimer.Enabled = True
Dim FTP As FTP
'StartServiceAt("", DateTime.Now + 60 * DateTime.TicksPerMinute, True)
End Sub
Sub Globals
Dim camera1 As Camera
Dim Panel1 As Panel
Dim Panel2 As Panel
Dim numero As Int
Dim pic As ResizePicture
Dim host
Dim usuario
Dim password
Dim segundos As String
Dim capture As CheckBox
Dim dominio As EditText
Dim servidorFTP As EditText
Dim usuarioFTP As EditText
Dim passwordFTP As EditText
Dim capturaFTP As String
Dim pathFTP As EditText
Dim seconds As EditText
Dim fotobn As ImageView
Dim fotoc As ImageView
'host="000.000.000.000"
'usuario="admin_camera"
'password="123456"
'uri="public_html/cam/"
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
Panel1.Visible=True
Panel2.visible= False
Dim myreadtext As String
myreadtext= File.ReadString(File.DirRootExternal & "/download","camera.dat")
If myreadtext<>"" Then
Dim domain As String
domain = myreadtext.IndexOf2("|", 0)
dominio.Text = myreadtext.SubString2(0, domain)
Dim uriServer As String
uriServer = myreadtext.IndexOf2("|",domain+1)
servidorFTP.text = myreadtext.SubString2(domain+1,uriServer)
Dim userServer As String
userServer = myreadtext.IndexOf2("|",uriServer+1)
usuarioFTP.text = myreadtext.SubString2(uriServer+1,userServer)
Dim passServer As String
passServer = myreadtext.IndexOf2("|",userServer+1)
passwordFTP.text = myreadtext.SubString2(userServer+1,passServer)
Dim pathServer As String
pathServer = myreadtext.IndexOf2("|",passServer+1)
pathFTP.text = myreadtext.SubString2(passServer+1,pathServer)
Dim captureDir As String
captureDir = myreadtext.IndexOf2("|",pathServer+1)
capture.Checked = myreadtext.SubString2(pathServer+1,captureDir)
End If
If FirstTime Then
FTP.Initialize("FTP", servidorFTP.text , 21, usuarioFTP.Text, passwordFTP.text )
End If
fotoc.Visible=False
fotobn.Visible=True
End Sub
Sub Camera1_Ready (Success As Boolean)
If Success Then
camera1.StartPreview
'btnTakePicture.Enabled = True
Else
ToastMessageShow("Cannot open camera.", True)
End If
End Sub
Sub connectiontimer_tick
fotoc.Visible=True
fotobn.Visible=False
connectiontimer.Enabled = True
'btnTakePicture.Enabled = False
camera1.TakePicture
End Sub
Sub Activity_Resume
'btnTakePicture.Enabled = False
camera1.Initialize(Panel1, "Camera1")
'Activity.finish
End Sub
Sub Activity_Pause (UserClosed As Boolean)
camera1.Release
End Sub
Sub Camera1_PictureTaken (Data() As Byte)
' saca una foto cada 30 segundos
Dim nomepath As String = File.DirRootExternal
numero= numero + 1
camera1.StartPreview
Dim out As OutputStream
'out = File.OpenOutput(File.DirRootExternal & "/CamFTP/", "1.jpg", False)
out = File.OpenOutput(nomepath , "1.jpg", False)
out.WriteBytes(Data, 0, Data.Length)
out.Close
'pic.resize( nomepath, "1.jpg", 300, 250, nomepath, "2","jpg","yes")
pic.resize( nomepath, "1.jpg", 800, 600, nomepath, "2","jpg","yes")
' sube la imagen 2.jpg al servidor potr FTP
'FTP.Initialize("FTP", host , 21, usuario , password )
FTP.Initialize("FTP", servidorFTP.text , 21, usuarioFTP.Text, passwordFTP.text )
'FTP.UploadFile(File.DirRootExternal , "2.jpg", False, uri & "2.jpg")
FTP.UploadFile(nomepath , "2.jpg", False, pathFTP.text & "cam.jpg")
File.WriteString(nomepath ,"check.txt",capture.Checked)
FTP.UploadFile(nomepath , "check.txt", False, pathFTP.text & "check.txt")
FTP.Close
' MENSAJE EN PANTALLA
'ToastMessageShow("FTP:" & File.Combine(File.DirRootExternal, "cam.jpg"), True)
fotoc.Visible=False
fotobn.Visible=True
End Sub
Sub save_Click
Dim linea
capturaFTP="1"
linea= dominio.Text & "|" & servidorFTP.text & "|" & usuarioFTP.text & "|" & passwordFTP.text & "|" & pathFTP.text & "|" & capture.Checked & "|"
File.WriteString(File.DirRootExternal & "/download","camera.dat",linea)
Panel2.Visible=False
End Sub
Sub fotobn_Click
Panel2.Visible=True
End Sub