![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 5 of 5 total |
![]() |
Tue, Dec 15 2020 8:26 PM | Permanent Link |
Ian Branch | Hi team,
If I have an image/picture saved to a Blob field, is there any metadata I can retrieve to identify the image? i.e. Filename or something. Regards & TIA, Ian |
Wed, Dec 16 2020 4:05 AM | Permanent Link |
Roy Lambert NLH Associates ![]() | Ian
There will only be metadata if its been created at the same time as the image (probably in exif). You can find out the type (I wouldn't call it metadata) function ImageFileTypeFromStream(ms: TMemoryStream; const default: string = 'jpg'): string; var ChkChars: array[0..20] of char; jpgCheck: array[0..4] of char; CharsToRead: integer; begin Result := default; ms.Seek(0, soFromBeginning); if ms.Size > 20 then CharsToRead := 20 else CharsToRead := ms.Size; ms.ReadBuffer(ChkChars, CharsToRead); if Pos('BM', ChkChars) = 1 then Result := 'bmp' else if Pos('GIF', ChkChars) = 1 then Result := 'gif' else if Pos(#137 + 'PNG' + #13#10, ChkChars) = 1 then Result := 'png' else if (Copy(ChkChars, 1, 2) = 'II') and (ChkChars[3] = '*') then Result := 'tiff' else if (Copy(ChkChars, 1, 2) = 'MM') and (ChkChars[4] = '*') then Result := 'tiff' else if (ms.Size > 10) and (Ord(ChkChars[0]) = 255) and (Ord(ChkChars[1]) = 216) and (Ord(ChkChars[2]) = 255) and (Ord(ChkChars[3]) in [219, 224, 225]) then Result := 'jpg'; ms.Seek(0, soFromBeginning); end; exif can be identified by if Pos('Exif', ChkChars) = 7 then Result := 'Exif' ; getting the rest of the metadata from the exif chunk is sonmething I never bothered with. Roy Lambert |
Wed, Dec 16 2020 4:25 AM | Permanent Link |
Ian Branch | Tks Roy,
A little more complicated than I thought and it looks like what I want isn't in there anyway. All I want to recover is the file name of the image that has been stored. Ian |
Wed, Dec 16 2020 4:30 AM | Permanent Link |
Ian Branch | Basically, I think I am out of luck.
![]() |
Wed, Dec 16 2020 5:00 AM | Permanent Link |
Roy Lambert NLH Associates ![]() | Ian
>Basically, I think I am out of luck. ![]() You are ![]() Only way to do that is to store the filename yourself, and then I'd ask which of the copies of the image I've made do you want to use as the filename? Roy |
This web page was last updated on Sunday, July 13, 2025 at 06:52 AM | Privacy Policy![]() © 2025 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |