I appoligize that I did not supply the correct Errormessage... sometimes difficult, I have to translate and do not know exactly what ist is in english.
The translation is why i personally dislike using native locale for lazarus/fpc as the common language to use is English.
No need to apologize, it is just that the error message is usually indicating the cause of what went wrong. You see it when running your code (of course), but we don't
The error trying to display a picure at the end (or in other Procedure) is: Exception-Class EInvalidGraphic unknown Pictureformat In File include\picture.inc line 5.7.8
ah, that is indeed a much more clear indication. Have you followed wp's advise to rewind the streams position ?
If that isn't helping then there is a possibility that the image loaded is indeed really unsupported (sound strange but it could happen).
but first let's take a look at your code:
... i = 1
cache[i-1] := TMemorystream.create; // i-1 = 1-1 = cache[0]
...
Image1.Picture.LoadFromStream(Cache[1]); //should display first file but crashes with Exception-Class EInvalidGraphic unknown Pictureformat In File include\picture.inc
...
so... that seems a bit off, not ?
You can always verify by using
if assigned(cache[1]) then Image1.Picture.LoadFromStream(Cache[1]) else showmessage('oops, error encountered')