#ifndef ___image_h__
#define ___image_h__

#include "HTTPPage.h"
#include "File.h"

namespace http {

   class _image : public HTTPPage {

      int page(HTTPParameters &p) override {

         char format[256];
         sprintf(format, "/home/barant/jetserver/image/%s", p.httpRequest.uriValues["image_name"].str().c_str());
         coreutils::File workspace(format);
         workspace.read();
         p.httpRequest.response.addHeader(coreutils::IMFHeader("Content-Type", "image/png"));
         p.data << workspace.asString();

         return 1;
      }

   };

}

#endif
