AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Datenbanken wie art der daten in blob erkennen?
Thema durchsuchen
Ansicht
Themen-Optionen

wie art der daten in blob erkennen?

Ein Thema von schorsch666 · begonnen am 30. Aug 2023 · letzter Beitrag vom 3. Sep 2023
 
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.542 Beiträge
 
Delphi 12 Athens
 
#9

AW: wie art der daten in blob erkennen?

  Alt 31. Aug 2023, 15:01
Boar eh ... immer und immer wieder ... die sollem mal richtige Entwickler einstellen, die ihr eigenes Produckt selber benutzen.

Du kannst dich aber selber an jedes einzelne ImageFormat wenden und es fragen,
Delphi-Referenz durchsuchenTGraphic.CanLoadFromStream

also TBitmap.CanLoadFromStream, TPngImage.CanLoadFromStream, TJPEGImage.CanLoadFromStream usw.

Ein GetFileFormats.FindFormat wäre natürlich einfacher, aber ..... mähhhhhhhhhh






Delphi-Quellcode:
unit Vcl.Graphics;

implementation <- was soll dieser perverse Scheiß immer?

var
  ClipboardFormats: TClipboardFormats = nil;
  FileFormats: TFileFormatsList = nil;

function GetFileFormats: TFileFormatsList;
begin
  if FileFormats = nil then FileFormats := TFileFormatsList.Create;
  Result := FileFormats;
end;

function GetClipboardFormats: TClipboardFormats;
begin
  if ClipboardFormats = nil then ClipboardFormats := TClipboardFormats.Create;
  Result := ClipboardFormats;
end;
Delphi-Quellcode:
procedure TPicture.LoadFromFile(const Filename: string);
var
  Ext: string;
  GraphicClass: TGraphicClass;
  Context: TFindGraphicClassContext;
begin
  Ext := ExtractFileExt(Filename).Remove(0, 1);
  GraphicClass := FileFormats.FindExt(Ext);
Delphi-Quellcode:
procedure TPicture.LoadFromStream(Stream: TStream);
var
  GraphicClass: TGraphicClass;
  Context: TFindGraphicClassContext;
begin
  if Stream.Size - Stream.Position = 0 then
    GraphicClass := TBitmap
  else
    GraphicClass := FileFormats.FindFormat(Stream);
Delphi-Quellcode:
procedure TPicture.LoadFromClipboardFormat(AFormat: Word; AData: THandle;
  APalette: HPALETTE);
var
  GraphicClass: TGraphicClass;
  Context: TFindGraphicClassContext;
begin
  GraphicClass := ClipboardFormats.FindFormat(AFormat);




das was öffentlich ist, ist hierfür nicht nutzbar.
Delphi-Quellcode:
function GraphicFilter(GraphicClass: TGraphicClass): string;
var
  Filters: string;
begin
  GetFileFormats.BuildFilterStrings(GraphicClass, Result, Filters);
end;

function GraphicExtension(GraphicClass: TGraphicClass): string;
var
  I: Integer;
begin
  for I := GetFileFormats.Count-1 downto 0 do
    if TFileFormatType(FileFormats[I]).GraphicClass.ClassName = GraphicClass.ClassName then
    begin
      Result := TFileFormatType(FileFormats[I]).Extension;
      Exit;
    end;
  Result := '';
end;

function GraphicFileMask(GraphicClass: TGraphicClass): string;
var
  Descriptions: string;
begin
  GetFileFormats.BuildFilterStrings(GraphicClass, Descriptions, Result);
end;
Ein Therapeut entspricht 1024 Gigapeut.

Geändert von himitsu (31. Aug 2023 um 15:10 Uhr)
  Mit Zitat antworten Zitat
 


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 03:26 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz