unit ServerModule;

interface

uses
  Classes, SysUtils, uniGUIServer, uniGUIMainModule, uniGUIApplication, uIdCustomHTTPServer,
  uniGUITypes,uUploadPicture;

type
  TUniServerModule = class(TUniGUIServerModule)
    procedure UniGUIServerModuleHTTPCommand(ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo;
      var Handled: Boolean);
    procedure UniGUIServerModuleCreate(Sender: TObject);
  private
    { Private declarations }

    FUploadPicture:TUploadPicture;

  protected
    procedure FirstInit; override;
  public
    { Public declarations }
  end;

function UniServerModule: TUniServerModule;

implementation

{$R *.dfm}

uses
  UniGUIVars;

function UniServerModule: TUniServerModule;
begin
  Result:=TUniServerModule(UniGUIServerInstance);
end;

procedure TUniServerModule.FirstInit;
begin
  InitServerModule(Self);


end;

procedure TUniServerModule.UniGUIServerModuleCreate(Sender: TObject);
begin
FUploadPicture:=TUploadPicture.Create(UniApplication);


end;

procedure TUniServerModule.UniGUIServerModuleHTTPCommand(ARequestInfo: TIdHTTPRequestInfo;
  AResponseInfo: TIdHTTPResponseInfo; var Handled: Boolean);

var PicPathValue,FileNameValue:string;

  begin


  if ARequestInfo.URI=('/CreateThumbnailOnServer') then
begin

PicPathValue:=ARequestInfo.Params.Values['PicPath'];
FileNameValue:=ARequestInfo.Params.Values['FileName'];

//FUploadPicture.DiminishPic(PicPathValue,128,128,FileNameValue);

AResponseInfo.ResponseNo:=200;
AResponseInfo.ContentText:=PicPathValue;
AResponseInfo.WriteContent;

end;


begin


end;



end;

initialization
  RegisterServerModuleClass(TUniServerModule);
end.
