AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein save image from database with TblobField
Thema durchsuchen
Ansicht
Themen-Optionen

save image from database with TblobField

Ein Thema von question · begonnen am 29. Aug 2013 · letzter Beitrag vom 29. Aug 2013
Antwort Antwort
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#1

save image from database with TblobField

  Alt 29. Aug 2013, 15:57
hi, i have the following query to save image from database, if i save an image which is 300 kb but when i want to save the same image from the database, it always save with a fixed size 33 kb

Code:
Query.SQL.Clear;
   Query.SQL.Add('select Image from TablePic where id =1');
   Query.Open;
BlobField := Query.FieldByName('Image ') As TBlobField;
   BlobField.SaveToFile(FileName);
dont have any idea why its save with fixed 33 kb, do you have any suggestion?
  Mit Zitat antworten Zitat
Der schöne Günther

Registriert seit: 6. Mär 2013
6.110 Beiträge
 
Delphi 10 Seattle Enterprise
 
#2

AW: save image from database with TblobField

  Alt 29. Aug 2013, 16:03
Just a random guess: Does TBlobField.SaveToStream(..) yield the same result?

Also, what are you saving the image with? Can you successfully retrieve the full amount of 300KB with another application?
  Mit Zitat antworten Zitat
Benutzerbild von sx2008
sx2008

Registriert seit: 15. Feb 2008
Ort: Baden-Württemberg
2.332 Beiträge
 
Delphi 2007 Professional
 
#3

AW: save image from database with TblobField

  Alt 29. Aug 2013, 16:14
Delphi-Quellcode:
Query.SQL.Text := 'select Image from TablePic where id =1';
Query.Open;
if Query.IsEmpty then // you should test this
  raise Exception.Create('image not found in database');
BlobField := Query.FieldByName('Image ') As TBlobField;
//...................................^ why is there a blank?
BlobField.SaveToFile(FileName);
Are you sure that you're checking the right file?
You should also check if the name "Image" is treated as a reserved word by your DBMS.
Probably it isn't a reserved word but if it is you will get weird results.
fork me on Github
  Mit Zitat antworten Zitat
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#4

AW: save image from database with TblobField

  Alt 29. Aug 2013, 16:24
I have checked the query whether is empty or not but the query is not empty
i have also change the name Image to Bild
but still it saves the size of 33 kb
  Mit Zitat antworten Zitat
Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#5

AW: save image from database with TblobField

  Alt 29. Aug 2013, 16:43
There's a space in your FieldByName. Maybe this causes Problems?
By the way: If you're german (because of your "Bild") then you may just speak german, because this is a german forum
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
  Mit Zitat antworten Zitat
Benutzerbild von Uwe Raabe
Uwe Raabe

Registriert seit: 20. Jan 2006
Ort: Lübbecke
11.021 Beiträge
 
Delphi 12 Athens
 
#6

AW: save image from database with TblobField

  Alt 29. Aug 2013, 16:47
Which database and which data access components?
Uwe Raabe
Certified Delphi Master Developer
Embarcadero MVP
Blog: The Art of Delphi Programming
  Mit Zitat antworten Zitat
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#7

AW: save image from database with TblobField

  Alt 29. Aug 2013, 20:48
it is Tquery component with mysql database and delphi 2010
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:33 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz