What do you mean with WriteHeader?
In Lazarus there is a header written before the actual image. The header contains the extension of the image (jpg/bmp/png etc) so the component knows what kind of image it is. The WriteHeader is true by default so in Lazarus the TDBImage writes this string before the actual data by default. For reading the WriteHeader is not used.
When reading data from the database the TDBImage looks if you implemented TDBImage.OnDBImageRead. If you did you need to provide the GraphExt-parameter with the correct image-type. After that TDBImage reads the image raw from the database. If you didn't implement TDBImage.OnDBImageRead then TDBImage expects the GraphExt-string to be part of the actual data in the database.
Related code:
procedure TDBImage.LoadPicture;
...
try
AGraphic := nil;
GraphExt := '';
if assigned(FOnDBImageRead) then
begin
// External method to identify graphic type
// returns file extension for graphic type (e.g. jpg)
// If user implements OnDBImageRead, the control assumes that
// the programmer either:
//
// -- Returns a valid identifier that matches a graphic class and
// the remainder of stream contains the image data. An instance of
// of graphic class will be used to load the image data.
// or
// -- Returns an invalid identifier that doesn't match a graphic class
// and the remainder of stream contains the image data. The control
// will try to load the image trying to identify the format
// by it's content
//
// In particular, returning an invalid identifier while the stream has
// a image header will not work.
OnDBImageRead(self,s,GraphExt);
GraphExtToClass;
end
else
ReadImageHeader;
I don't think you wrote the extension in Delphi before the image. I don't think the TDBImage in Delphi has this extension capability. So, to keep it compatible, you need to implement that OnDBImageRead and provide the GraphExt. And when writing the image back to the database you need to set WriteHeader to false.
Only thing is that you need to provide the GraphExt and if you don't know which type is saved then you don't know what to provide. But you had the same trouble in Delphi

If the image is always jpg that isn't really a problem.