Ver Mensaje Individual
  #1  
Antiguo 23-01-2023
giantonti1801 giantonti1801 is offline
Miembro
 
Registrado: oct 2022
Posts: 143
Reputación: 2
giantonti1801 Va por buen camino
Stream Write Error

hola amigo en esta ocasión estoy desarrollando una aplicación con delphi 11 en multiplataforma y quiero reducir las imagen. esta misma funcion la estoy utilizando en una aplicacion para android y me finciona perfecto pero ahora la estoy implementando en windows 64BIt y me da error de 'Stream Write Error'

Código Delphi [-]
procedure TFormLogin.SpeedButtonGuardarClick(Sender: TObject);
var
Image: TBitmap;
bmp: TBitmap;
NewBitmap: TBitmap;
MS1 : TMemoryStream;
Surf: TBitmapSurface;
JpgQuality : TBitmapCodecSaveParams;
begin
   NewBitmap := ImageFotoReg.bitmap;
   MS1 := TMemoryStream.Create;
   Surf := TBitmapSurface.create;
   try
   MS1.Position := 0;
   Surf.Assign(NewBitmap);
   JpgQuality.Quality := 30;
     if not TBitmapCodecManager.SaveToStream(MS1, Surf, '.jpg', @JpgQuality) then
     raise EBitmapSavingFailed.Create('Error saving Bitmap to jpg');
      begin

        if editNombre.text = '' then
        //   begin
           ShowMessage('El nombre no puede estar vacio');
        if editApellido.text = '' then
           ShowMessage('El Apellidos no puede estar vacio');
        if editRUT.text = '' then
           ShowMessage('El RUT no puede estar vacio') ;
        if editCodigo.text = '' then
           ShowMessage('El Codigo de Medigo no puede estar vacio');
        if editTelefono.text = '' then
           ShowMessage('El Telefono no puede estar vacio');
        if editciudad.text = '' then
           ShowMessage('El Ciudad no puede estar vacio');
        if EditrRegion.text = '' then
           ShowMessage('El Region no puede estar vacio') ;
        if editDireccion.text = '' then
           ShowMessage('La Direccion no puede estar vacia');
        if editlogin.text = '' then
           ShowMessage('El Login no puede estar vacio')
        //if editPassword.text = '' then
        //   ShowMessage('El Password no puede estar vacio')

       else
        begin

          UniQuery1.Close;
          UniQuery1.SQL.Clear;
          UniQuery1.SQL.Add('INSERT INTO Login (NOM,APE,RUT,CODMED,TEL,DIR,CIUDAD,ESTADO,FOTO, FECHAREG,LOGIN, PAS, INST)');           //
          UniQuery1.SQL.Add('VALUES (:NOM :APE :RUT :CODMED :TEL IR :CIUDAD :ESTADO :FOTO :FECHAREG :LOGIN :PAS :INST)');                      //,
          UniQuery1.ParamByName('NOM').AsString := EDITNombre.text;
          UniQuery1.ParamByName('APE').AsString := EditApellido.Text;
          UniQuery1.ParamByName('RUT').Asstring := EditRUT.text;
          UniQuery1.ParamByName('CODMED').AsString := EditCodigo.text;
          UniQuery1.ParamByName('TEL').AsString := EditTelefono.TEXT;
          UniQuery1.ParamByName('CIUDAD').Asstring := EditCiudad.TEXT;
          UniQuery1.ParamByName('ESTADO').Asstring := EditRREGION.TEXT;
          UniQuery1.ParamByName('DIR').Asstring := EditDireccion.TEXT;
          UniQuery1.ParamByName('INST').Asstring := ComboBoxInst.Items.Text;
          UniQuery1.ParamByName('LOGIN').Asstring := EditLOGIN.TEXT;
          UniQuery1.ParamByName('PAS').Asstring := EditPASSWORD.TEXT;
          UniQuery1FOTO.LoadFromStream(MS1);
          UniQuery1.ExecSQL;
          end;
        end;
       //end;
   finally
    //NewBitmap.Free;
    MS1.Free;
    Surf.Free;
   end;
end;

mucho agradecería su ayuda.
Responder Con Cita