Autor Beitrag
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Di 10.07.12 18:02 
:bawling: wieder nicht richtig gelesen, sorry ...

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS
Terra23 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 872

Win 8
Delphi 7
BeitragVerfasst: Di 10.07.12 19:47 
Ich habe mir jetzt mal die Unit "TPNGImage" ausm Netz runtergeladen und zu den anderen Units gepackt. Dann kam die Meldung "Datei nicht gefunden: 'ZLibEx.dcu'", obwohl diese Unit gar nicht unter "Uses" aufgeführt ist.

Muss ich jetzt tatsächlich ne andere Komponente (TPNGImage) suchen und installieren? Die TImage-Komponente aus Delphi 7 kennt doch PNG-Dateien. Warum ist das Ganze jetzt am Ende doch so kompliziert?

Klar, wenn man programmiert, darf man nicht erwarten, dass man alles serviert bekommt, aber wenn eine Komponente schon mit den Dateien umgehen kann, dürfte man dann nicht erwarten, dass die auch funktioniert?

Gruß,

Terra

_________________
Hasta La Victoria Siempre
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19277
Erhaltene Danke: 1741

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 10.07.12 21:13 
Ich habe keine Ahnung welche Komponente du da hast, aber die Standardkomponente, die jetzt mit Delphi mitgeliefert wird, funktioniert bei mir problemlos:
www.torry.net/authorsmore.php?id=6929
Terra23 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 872

Win 8
Delphi 7
BeitragVerfasst: Di 10.07.12 21:21 
Ich verfüge über die Standard-Komponente (TImage) und die aus den JediVCLs (TJvImage). Die Unit "TPNGImage" hatte ich mir "lose" also einzeln heruntergeladen ohne eine Komponente dazu.

Wie installiere ich denn die Komponente, die du verlinkt hast?

_________________
Hasta La Victoria Siempre
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19277
Erhaltene Danke: 1741

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 10.07.12 21:23 
Du entpackst das Zip-Archiv und fügst den Pfad dem Bibliothekspfad hinzu oder die Units dem Projekt.
Terra23 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 872

Win 8
Delphi 7
BeitragVerfasst: Di 10.07.12 21:30 
Das Programm beschwert sich immer noch über "TPNGImage".

Ich habe den Ordner in die Bibliothek aufgenommen und die Unit ins Programm.

Trotzdem beschwert es sich...

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
procedure TForm1.Button2Click(Sender: TObject);
var ImgStream: TMemoryStream;
    Art: String;
    JPGBild: TJPEGImage;
    PNGBild: TPNGImage; -> hier beschwert sich das Programm (Undefinierter Bezeichner: TPNGImage)
begin
Diverse Aktionen, die für den Fehler irrelevant sind

/// Bestimme die Dateiendung des Bildes (URL steht in Label1.Caption)
Art := Copy(Label1.Caption, J, 3);

/// Wenn es ein JPG ist, lade es...
If Art = 'jpg'
Then Begin
     Try
     ImgStream := TMemoryStream.Create;
     IdHTTP1.Get(Label1.Caption, ImgStream);
     ImgStream.Position := 0;
     JPGBild := TJPEGImage.Create;
     JPGBild.LoadFromStream(ImgStream);
     JvImage1.Picture.Assign(JPGBild);
     Finally
     JPGBild.Free;
     ImgStream.Free;
     End;
     End;

/// Wenn es ein PNG ist, lade es...
If Art = 'png'
Then Begin
     Try
     ImgStream := TMemoryStream.Create;
     IdHTTP1.Get(Label1.Caption, ImgStream);
     ImgStream.Position := 0;
     PNGBild := TPNGImage.Create;
     PNGBild.LoadFromStream(ImgStream);
     JvImage1.Picture.Assign(PNGBild);
     Finally
     PNGBild.Free;
     ImgStream.Free;
     End;
     End;


jaenicke, weißt du da Rat? Das übersteigt echt meine dürftigen Programmierkenntnisse...

_________________
Hasta La Victoria Siempre
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19277
Erhaltene Danke: 1741

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 10.07.12 21:31 
Du musst auch noch die Unit PngImage in die uses Klausel aufnehmen.
Terra23 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 872

Win 8
Delphi 7
BeitragVerfasst: Di 10.07.12 21:33 
Hab ich doch schon...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPConnection,
  IdTCPClient, IdHTTP, ShellApi, ExtCtrls, JPEG, JvImage, JvExExtCtrls, PNGImage,
  PNGExtra;

_________________
Hasta La Victoria Siempre
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19277
Erhaltene Danke: 1741

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Di 10.07.12 21:35 
Ah, tut mir leid, ich habe kurz in die Unit hineingeschaut, die Klasse heißt TPngObject. :idea:
Terra23 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 872

Win 8
Delphi 7
BeitragVerfasst: Di 10.07.12 21:42 
Vielen Dank, es funktioniert.

Hier nochmal für alle, die zukünftig auf diesen Thread stoßen, die Zusammenfassung:


So lädt man ein JPG aus einem Stream in ein Image:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm1.Button2Click(Sender: TObject);
var ImgStream: TMemoryStream;
    JPGBild: TJPEGImage;
    PNGBild: TPNGObject;
begin
     Try
     ImgStream := TMemoryStream.Create;
     IdHTTP1.Get(/// URL des Bildes, ImgStream);
     ImgStream.Position := 0;
     JPGBild := TJPEGImage.Create;
     JPGBild.LoadFromStream(ImgStream);
     Image1.Picture.Assign(JPGBild);
     Finally
     JPGBild.Free;
     ImgStream.Free;
     End;
     End;


So lädt man ein PNG aus einem Stream in ein Image:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure TForm1.Button2Click(Sender: TObject);
var ImgStream: TMemoryStream;
    JPGBild: TJPEGImage;
    PNGBild: TPNGObject;
begin
     Try
     ImgStream := TMemoryStream.Create;
     IdHTTP1.Get(/// URL des Bildes, ImgStream);
     ImgStream.Position := 0;
     PNGBild := TPNGObject.Create;
     PNGBild.LoadFromStream(ImgStream);
     JvImage1.Picture.Assign(PNGBild);
     Finally
     PNGBild.Free;
     ImgStream.Free;
     End;

_________________
Hasta La Victoria Siempre