![]() |
| Clomosy Resmi Forum Sitesidir. Amacımız kullanıcılarımıza, iş ortaklarımıza, danışmanlara, yazılımcılara programlarımız hakkında destek ve bilgi vermektir. |
Görsel Api İle Web e Gönderme |
Yanıt Yaz
|
| Yazar | |
Hüseyin_Sadik
Yeni Üye
Kayıt Tarihi: 03 Aralık 2025 Durum: Aktif Değil Puanlar: 27 |
Mesaj Seçenekleri
Yanıt Yaz
Alıntı Hüseyin_Sadik
Bu mesaj kurallara aykırıysa buradan yöneticileri bilgilendirebilirsiniz.
Teşekkürler(0)
Alıntı Cevapla
Konu: Görsel Api İle Web e GöndermeGönderim Zamanı: 5 Saat 35 Dakika Önce Saat 10:29 |
|
Clomosy'de herhangi bir projede görseli api ile nasıl web e gönderilebilir.
|
|
![]() |
|
Emr.Erkmn
Moderatör
Kayıt Tarihi: 28 Şubat 2025 Durum: Aktif Değil Puanlar: 950 |
Mesaj Seçenekleri
Yanıt Yaz
Alıntı Emr.Erkmn
Bu mesaj kurallara aykırıysa buradan yöneticileri bilgilendirebilirsiniz.
Teşekkürler(0)
Alıntı Cevapla
Gönderim Zamanı: 5 Saat 30 Dakika Önce Saat 10:34 |
|
Merhaba Hüseyin
seçilen görseli rest api servisine göndermek için görseli base64 formatına dönüştürüp bir json gövdesi içierisinde post etmen gerekli aşağıda bir örnek bırakıyorum var AnaForm: TclForm; KapsayiciPnl: TclProPanel; SecilenGorsel: TclProImage; BtnGorselSec: TclProButton; BtnWebGonder: TclProButton; GlobalRest: TclRest; void OnApiResponseCompleted; { try if (GlobalRest.Response <> '') { ShowMessage('Görsel başarıyla web sunucusuna gönderildi! Sunucu Yanıtı: ' + GlobalRest.Response); } else { ShowMessage('Görsel gönderildi fakat sunucudan boş yanıt döndü.'); } GlobalRest.Free; except ShowMessage('Yükleme yanıtı işleme hatası: ' + LastExceptionMessage); } } void OnGorselSecClick; { Clomosy.ImageChooser(AnaForm, SecilenGorsel); } void OnWebGonderClick; var LBase64Veri: String; LJsonGovde: String; LWebUrl: String; { if (SecilenGorsel.clProSettings.PictureSource == '') { ShowMessage('Lütfen önce gönderilecek bir görsel seçiniz!'); Exit; } try LBase64Veri = Clomosy.FileToBase64(SecilenGorsel.clProSettings.PictureSource); LJsonGovde = '{"image_name":"mobil_gorsel.jpg", "image_data":"' + LBase64Veri + '"}'; LWebUrl = 'https://sizin-web-servisiniz.com/api/upload'; GlobalRest = TclRest.Create; GlobalRest.BaseURL = LWebUrl; GlobalRest.Method = rmPOST; GlobalRest.Accept = 'application/json'; GlobalRest.AddBody(LJsonGovde, 'application/json'); GlobalRest.OnCompleted = 'OnApiResponseCompleted'; GlobalRest.ExecuteAsync; ShowMessage('Görsel arka planda web sunucusuna yükleniyor, lütfen bekleyiniz...'); except ShowMessage('Görsel dönüştürme veya API hatası: ' + LastExceptionMessage); } } { AnaForm = TclForm.Create(Self); AnaForm.clSetCaption('API Görsel Gönderimi'); AnaForm.SetFormColor('#1e1e2e', '#1e1e2e', clGNone); KapsayiciPnl = AnaForm.AddNewProPanel(AnaForm, 'KapsayiciPnl'); KapsayiciPnl.Align = alClient; KapsayiciPnl.Margins.Left = 20; KapsayiciPnl.Margins.Right = 20; KapsayiciPnl.Margins.Top = 20; KapsayiciPnl.Margins.Bottom = 20; KapsayiciPnl.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#2e2e3e'); KapsayiciPnl.clProSettings.RoundHeight = 12; KapsayiciPnl.clProSettings.RoundWidth = 12; KapsayiciPnl.SetclProSettings(KapsayiciPnl.clProSettings); SecilenGorsel = AnaForm.AddNewProImage(KapsayiciPnl, 'SecilenGorsel'); SecilenGorsel.Align = alTop; SecilenGorsel.Height = 250; SecilenGorsel.Margins.Top = 15; SecilenGorsel.Margins.Left = 15; SecilenGorsel.Margins.Right = 15; SecilenGorsel.clProSettings.PictureAutoFit = True; SecilenGorsel.clProSettings.RoundHeight = 8; SecilenGorsel.clProSettings.RoundWidth = 8; SecilenGorsel.SetclProSettings(SecilenGorsel.clProSettings); BtnGorselSec = AnaForm.AddNewProButton(KapsayiciPnl, 'BtnGorselSec', '📸 GÖRSEL SEÇ / ÇEK'); BtnGorselSec.Align = alTop; BtnGorselSec.Height = 45; BtnGorselSec.Margins.Top = 20; BtnGorselSec.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#3B82F6'); BtnGorselSec.clProSettings.FontColor = clAlphaColor.clWhite; BtnGorselSec.clProSettings.TextSettings.Font.Style = [fsBold]; BtnGorselSec.clProSettings.RoundHeight = 8; BtnGorselSec.clProSettings.RoundWidth = 8; BtnGorselSec.SetclProSettings(BtnGorselSec.clProSettings); AnaForm.AddNewEvent(BtnGorselSec, tbeOnClick, 'OnGorselSecClick'); BtnWebGonder = AnaForm.AddNewProButton(KapsayiciPnl, 'BtnWebGonder', '🌐 WEB''E API İLE GÖNDER'); BtnWebGonder.Align = alTop; BtnWebGonder.Height = 45; BtnWebGonder.Margins.Top = 15; BtnWebGonder.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#10B981'); BtnWebGonder.clProSettings.FontColor = clAlphaColor.clWhite; BtnWebGonder.clProSettings.TextSettings.Font.Style = [fsBold]; BtnWebGonder.clProSettings.RoundHeight = 8; BtnWebGonder.clProSettings.RoundWidth = 8; BtnWebGonder.SetclProSettings(BtnWebGonder.clProSettings); AnaForm.AddNewEvent(BtnWebGonder, tbeOnClick, 'OnWebGonderClick'); AnaForm.FormWaiting.Visible = False; AnaForm.BtnFormMenu.Visible = False; AnaForm.BtnGoBack.Visible = False; AnaForm.Run; https://static.cloudflareinsights.com/beacon.min.js/v4513226cdae34746b4dedf0b4dfa099e1781791509496" integrity="sha512-ZE9pZaUXND66v380QUtch/5sE9tPFh2zg45pR2PB0CVkCtOREv2AJKkSidISWkysEuQ0EH8faUU5du78bx87UQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">
|
|
![]() |
|
Emr.Erkmn
Moderatör
Kayıt Tarihi: 28 Şubat 2025 Durum: Aktif Değil Puanlar: 950 |
Mesaj Seçenekleri
Yanıt Yaz
Alıntı Emr.Erkmn
Bu mesaj kurallara aykırıysa buradan yöneticileri bilgilendirebilirsiniz.
Teşekkürler(0)
Alıntı Cevapla
Gönderim Zamanı: 1 saat 51 Dakika Önce Saat 14:13 |
|
var AnaForm: TclForm; KapsayiciPnl: TclProPanel; SecilenGorsel: TclImage; BtnGorselSec: TclProButton; BtnWebGonder: TclProButton; void OnGorselSecClick; { Clomosy.ImageChooser(AnaForm, SecilenGorsel); } void OnWebGonderClick; var LBase64Veri: String; LJsonGovde: String; LWebUrl: String; LRest: TclRest; LMemStream: TCLMemoryStream; { LMemStream = TCLMemoryStream.Create; try SecilenGorsel.Bitmap.SaveToStream(LMemStream); if (LMemStream.Size == 0) { ShowMessage('Lütfen önce gönderilecek bir görsel seçiniz!'); Exit; } LBase64Veri = LMemStream.AsBase64; LJsonGovde = '{"image_name":"mobil_gorsel.jpg", "image_data":"' + LBase64Veri + '"}'; LWebUrl = 'https://sizin-web-servisiniz.com/api/upload'; LRest = TclRest.Create; try LRest.BaseURL = LWebUrl; LRest.Method = rmPOST; LRest.Accept = 'application/json'; LRest.AddBody(LJsonGovde, 'application/json'); LRest.Execute; if (LRest.Response <> '') { ShowMessage('Görsel başarıyla gönderildi! Sunucu Yanıtı: ' + LRest.Response); } else { ShowMessage('Görsel gönderildi fakat sunucudan boş yanıt döndü.'); } finally LRest.Free; } finally LMemStream.Free; } } { AnaForm = TclForm.Create(Self); AnaForm.clSetCaption('TclImage ile API Görsel Gönderimi'); AnaForm.SetFormColor('#1e1e2e', '#1e1e2e', clGNone); KapsayiciPnl = AnaForm.AddNewProPanel(AnaForm, 'KapsayiciPnl'); KapsayiciPnl.Align = alClient; KapsayiciPnl.Margins.Left = 20; KapsayiciPnl.Margins.Right = 20; KapsayiciPnl.Margins.Top = 20; KapsayiciPnl.Margins.Bottom = 20; KapsayiciPnl.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#2e2e3e'); KapsayiciPnl.clProSettings.RoundHeight = 12; KapsayiciPnl.clProSettings.RoundWidth = 12; KapsayiciPnl.SetclProSettings(KapsayiciPnl.clProSettings); SecilenGorsel = AnaForm.AddNewImage(KapsayiciPnl, 'SecilenGorsel'); SecilenGorsel.Align = alTop; SecilenGorsel.Height = 250; SecilenGorsel.Margins.Top = 15; SecilenGorsel.Margins.Left = 15; SecilenGorsel.Margins.Right = 15; BtnGorselSec = AnaForm.AddNewProButton(KapsayiciPnl, 'BtnGorselSec', '📸 GÖRSEL SEÇ / ÇEK'); BtnGorselSec.Align = alTop; BtnGorselSec.Height = 45; BtnGorselSec.Margins.Top = 20; BtnGorselSec.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#3B82F6'); BtnGorselSec.clProSettings.FontColor = clAlphaColor.clWhite; BtnGorselSec.clProSettings.TextSettings.Font.Style = [fsBold]; BtnGorselSec.clProSettings.RoundHeight = 8; BtnGorselSec.clProSettings.RoundWidth = 8; BtnGorselSec.SetclProSettings(BtnGorselSec.clProSettings); AnaForm.AddNewEvent(BtnGorselSec, tbeOnClick, 'OnGorselSecClick'); BtnWebGonder = AnaForm.AddNewProButton(KapsayiciPnl, 'BtnWebGonder', '🌐 WEB''E API İLE GÖNDER'); BtnWebGonder.Align = alTop; BtnWebGonder.Height = 45; BtnWebGonder.Margins.Top = 15; BtnWebGonder.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#10B981'); BtnWebGonder.clProSettings.FontColor = clAlphaColor.clWhite; BtnWebGonder.clProSettings.TextSettings.Font.Style = [fsBold]; BtnWebGonder.clProSettings.RoundHeight = 8; BtnWebGonder.clProSettings.RoundWidth = 8; BtnWebGonder.SetclProSettings(BtnWebGonder.clProSettings); AnaForm.AddNewEvent(BtnWebGonder, tbeOnClick, 'OnWebGonderClick'); AnaForm.FormWaiting.Visible = False; AnaForm.BtnFormMenu.Visible = False; AnaForm.BtnGoBack.Visible = False; AnaForm.Run; } https://static.cloudflareinsights.com/beacon.min.js/v4513226cdae34746b4dedf0b4dfa099e1781791509496" integrity="sha512-ZE9pZaUXND66v380QUtch/5sE9tPFh2zg45pR2PB0CVkCtOREv2AJKkSidISWkysEuQ0EH8faUU5du78bx87UQ==" data-cf-beacon="{"version":"2024.11.0","token":"439455f3e46c40b98dbd42a2f1a954d8","r":1,"server_timing":{"name":{"cfCacheStatus":true,"cfEdge":true,"cfExtPri":true,"cfL4":true,"cfOrigin":true,"cfSpeedBrain":true},"location_startswith":null}}" crossorigin="anonymous">
|
|
![]() |
|
Yanıt Yaz
|
|
| Tweet |
| Forum Atla | Forum İzinleri ![]() Kapalı Foruma Yeni Konu Gönderme Kapalı Forumdaki Konulara Cevap Yazma Kapalı Forumda Cevapları Silme Kapalı Forumdaki Cevapları Düzenleme Kapalı Forumda Anket Açma Kapalı Forumda Anketlerde Oy Kullanma |