//Elimde şöyle bir kod var fotoğrafı base64e çevirebiliyorum ama nasıl base64ü fotoğrafa //çevircem bilmiyorum
var
MyForm: TclForm;
GetImageBaseBtn,
ImageAddBtn, Controlbtn, Kaydetbtn,ResmeCevir: TClProButton;
NoteLabel:
TClProLabel;
noteMemo: TCLMemo;
CameraImg ,
SourceImg: TClImage;
LMemStream:
TCLMemoryStream;
Qry: TClSQLiteQuery;
database , password
: String;
/*
void GetData;
{
try
Qry =
Clomosy.DBSQLiteQueryWith('SELECT GetImageBase64 FROM Categories');
Qry.OpenOrExecute;
noteMemo.Text =
Qry.FieldByName('GetImageBase64').AsString;
ShowMessage('Veritabanına Kaydedildi ');
except
ShowMessage('basarısız');
}
}
*/
void VeritabaninaKaydet;
{
try
Clomosy.DBSQLiteQuery.SQL.Text = 'INSERT INTO Categories
(GetImageBase64) VALUES (' + QuotedStr(noteMemo.Text) + ')';
Clomosy.DBSQLiteQuery.OpenOrExecute;
//GetData;
except
ShowMessage('basarısız');
}
}
void ResmeCevirme;
{
ShowMessage('calısıyor');
}
void addImageClick;
{
Clomosy.ImageChooser(MyForm, CameraImg);
}
void getImageBase64;
{
CameraImg.Bitmap.SaveToStream(LMemStream);
noteMemo.Lines.Text
= LMemStream.AsBase64;
}
{
MyForm =
TclForm.Create(nil);
LMemStream =
TCLMemoryStream.Create;
CameraImg =
MyForm.AddNewImage(MyForm, 'CameraImg');
CameraImg.Align =
alTop;
CameraImg.Height =
80;
CameraImg.Width =
220;
CameraImg.Margins.Top = 12;
CameraImg.Margins.Right = 12;
CameraImg.Margins.Bottom = 12;
CameraImg.Margins.Left = 12;
SourceImg =
MyForm.AddNewImage(MyForm,'SourceImg');
SourceImg.Align =
alClient;
ImageAddBtn =
MyForm.AddNewProButton(MyForm, 'ImageAddBtn', 'Görsel Ekle');
clComponent.SetupComponent(ImageAddBtn, '{"Align" :
"Bottom", "TextSize":16,
"TextBold":"yes",
"BackgroundColor":"#00b282", "RoundWidth":8,
"RoundHeight":8, "TextColor":"#ffffff",
"Height":42, "MarginBottom":16}');
MyForm.AddNewEvent(ImageAddBtn, tbeOnClick, 'addImageClick'); // kamera
açtıran buton
GetImageBaseBtn =
MyForm.AddNewProButton(MyForm, 'GetImageBaseBtn', 'Base64Convert');
MyForm.AddNewEvent(GetImageBaseBtn, tbeOnClick, 'getImageBase64');
clComponent.SetupComponent(GetImageBaseBtn, '{"Align" :
"Bottom", "TextSize":16,
"TextBold":"yes",
"BackgroundColor":"#2465ff", "RoundWidth":8,
"RoundHeight":8, "TextColor":"#ffffff",
"Height":42, "MarginBottom":16,
"MarginTop":16}');
Kaydetbtn =
MyForm.AddNewProButton(MyForm, 'Kaydetbtn', 'VeritabaninaKaydet');
MyForm.AddNewEvent(Kaydetbtn, tbeOnClick, 'VeritabaninaKaydet');
clComponent.SetupComponent(Kaydetbtn, '{"Align" :
"Bottom", "TextSize":16,
"TextBold":"yes",
"BackgroundColor":"#2465ff", "RoundWidth":8,
"RoundHeight":8, "TextColor":"#ffffff",
"Height":42, "MarginBottom":16,
"MarginTop":16}');
ResmeCevir =
MyForm.AddNewProButton(MyForm, 'ResmeCevir', 'ResmeCevirme');
MyForm.AddNewEvent(ResmeCevir, tbeOnClick, 'ResmeCevirme');
clComponent.SetupComponent(ResmeCevir, '{"Align" :
"Bottom", "TextSize":16,
"TextBold":"yes",
"BackgroundColor":"#2465ff", "RoundWidth":8,
"RoundHeight":8, "TextColor":"#ffffff",
"Height":42, "MarginBottom":16,
"MarginTop":16}');
noteMemo =
MyForm.AddNewMemo(MyForm, 'noteMemo', 'Bir Not Giriniz');
noteMemo.StyledSettings = ssFamily;
noteMemo.TextSettings.WordWrap = True;
noteMemo.Height =
30;
noteMemo.Align =
alBottom;
Clomosy.DBSQLiteConnect(Clomosy.AppFilesPath + 'DbDeneme.db3', '');
database = Clomosy.AppFilesPath + 'DbDeneme.db3'
password = '';
try
Clomosy.DBSQLiteConnect(database , password);
Clomosy.DBSQLiteQuery.SQl.Text = 'CREATE TABLE Categories(GetImageBase64
Text)';
Clomosy.DBSQLiteQuery.OpenOrExecute;
ShowMessage('Veri
tabanına tablo ekleme işlemi başarılı!');
except
ShowMessage('Exception Class: '+LastExceptionClassName+' Exception
Message: '+LastExceptionMessage);
}
// GetData;
MyForm.Run;
}
|