Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Knora integration #267

Merged
merged 25 commits into from
Nov 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f0367af
Added path for getting original filename and mimetype
lrosenth Oct 19, 2018
9d4a138
Bugfix for unittest
lrosenth Oct 19, 2018
c207fba
Bugfix to support Essential metadata
lrosenth Oct 30, 2018
0b68da9
Small bugfixes
lrosenth Oct 30, 2018
3591114
Unittests for knora.json and info.json
lrosenth Nov 1, 2018
c54aac5
Unittests for knora.json and info.json
lrosenth Nov 1, 2018
b2a8d28
More functions for lua
lrosenth Nov 1, 2018
9630708
test if modtime
lrosenth Nov 1, 2018
01401ed
added testimage
lrosenth Nov 2, 2018
6041b5a
Better testing
lrosenth Nov 2, 2018
d274dcc
minor change
lrosenth Nov 5, 2018
eb48457
Add Lua clean_tempdir() function for cleaning up old temporary files.
Nov 6, 2018
002fa8a
Create temp dir in test if it doesn't already exist.
Nov 6, 2018
c86c7b9
Better error-checking in test.
Nov 6, 2018
ee351c1
Use clearer names in knora.json response.
Nov 8, 2018
52b271d
Fix knora.json test.
Nov 8, 2018
b36da1a
more features for knora integration
lrosenth Nov 8, 2018
8206131
Merge branch 'knora-integration' of github.com:dhlab-basel/Sipi into …
lrosenth Nov 8, 2018
1455693
Clarify server.post doc.
Nov 8, 2018
696a169
unit tests for new functions
lrosenth Nov 8, 2018
42aa486
Merge branch 'knora-integration' of github.com:dhlab-basel/Sipi into …
lrosenth Nov 8, 2018
d97c69e
Some imrpovements
lrosenth Nov 8, 2018
65afc0a
Clean temporary directory recursively.
Nov 9, 2018
f0c73bd
Don't process a payload in an HTTP DELETE request.
Nov 9, 2018
97baf6a
Clarify SipiImage.new documentation.
Nov 9, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ icc.zip

# ignore test results
/Testing
/test/nginx/logs/error.log
_lena512.jp2
13 changes: 11 additions & 2 deletions config/sipi.config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ sipi = {
-- The secret for generating JWT's (JSON Web Tokens) (exactly 42 characters)
--
jwt_secret = 'UP 4888, nice 4-8-4 steam engine',
-- 12345678901234567890123456789012
-- 123456789012345678901234567890123456789012

--
-- Name of the logfile (a ".txt" is added...) !!! Currently not used, since logging
Expand All @@ -192,6 +192,11 @@ sipi = {
-- loglevel, one of "EMERGENCY", "ALERT", "CRITICAL", "ERROR", "WARNING", "NOTICE", "INFORMATIONAL", "DEBUG"
--
loglevel = "DEBUG",

--
-- The maximum allowed age of temporary files (in seconds) before they are deleted. Defaults to one day.
--
max_temp_file_age = 86400
}

admin = {
Expand Down Expand Up @@ -253,6 +258,10 @@ routes = {
method = 'GET',
route = '/luaexe/test2',
script = 'test2.lua'
},
{
method = 'POST',
route = '/api/upload',
script = 'upload.lua'
}

}
6 changes: 3 additions & 3 deletions config/sipi.debug-config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ sipi = {
logfile = "sipi.log",

--
-- loglevel, one of "TRACE", "DEBUG", "INFO", "NOTICE", "WARN", "ERROR",
-- "CRITICAL", "ALERT", "EMER", "OFF"
-- loglevel, one of "DEBUG", "INFO", "NOTICE", "WARNING", "ERR",
-- "CRIT", "ALERT", "EMERG"
--
loglevel = "TRACE",
loglevel = "DEBUG",
}

--
Expand Down
3 changes: 3 additions & 0 deletions include/SipiConf.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace Sipi {
std::string ssl_key;
#endif
std::string img_root; //<! path to root of image repository
int max_temp_file_age;
int subdir_levels = -1;
std::vector<std::string> subdir_excludes;
bool prefix_as_path; //<! Use IIIF-prefix as part of path or ignore it...
Expand Down Expand Up @@ -97,6 +98,8 @@ namespace Sipi {

inline std::string getImgRoot(void) { return img_root; }

inline int getMaxTempFileAge(void) { return max_temp_file_age; }

inline bool getPrefixAsPath(void) { return prefix_as_path; }

inline int getJpegQuality(void) { return jpeg_quality; }
Expand Down
19 changes: 18 additions & 1 deletion include/SipiIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@ namespace Sipi {
ScalingMethod png;
} ScalingQuality;

class SipiImgInfo {
public:
enum { FAILURE = 0, DIMS = 1, ALL = 2 } success;
int width;
int height;
std::string origname;
std::string mimetype;

SipiImgInfo(void) {
success = FAILURE;
width = 0;
height = 0;
};
};

class SipiImage; //!< forward declaration of class SipiImage

Expand All @@ -54,6 +68,9 @@ namespace Sipi {
*/
class SipiIO {
public:
virtual ~SipiIO() {};


/*!
* Method used to read an image file
*
Expand All @@ -75,7 +92,7 @@ namespace Sipi {
* \param[out] width Width of the image in pixels
* \param[out] height Height of the image in pixels
*/
virtual bool getDim(std::string filepath, size_t &width, size_t &height) = 0;
virtual SipiImgInfo getDim(std::string filepath) = 0;

/*!
* Write an image for a file using the given file format implemented by the subclass
Expand Down
3 changes: 2 additions & 1 deletion include/SipiImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ namespace Sipi {
SKIP_NONE = 0x00, SKIP_ICC = 0x01, SKIP_XMP = 0x02, SKIP_IPTC = 0x04, SKIP_EXIF = 0x08, SKIP_ALL = 0xFF
} SkipMetadata;

enum InfoError { INFO_ERROR };

/*!
* This class implements the error handling for the different image formats.
Expand Down Expand Up @@ -388,7 +389,7 @@ namespace Sipi {
* \param[out] width Width of the image in pixels
* \param[out] height Height of the image in pixels
*/
static void getDim(std::string filepath, size_t &width, size_t &height);
SipiImgInfo getDim(std::string filepath);

/*!
* Get the dimension of the image object
Expand Down
3 changes: 2 additions & 1 deletion include/formats/SipiIOJ2k.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ namespace Sipi {
class SipiIOJ2k : public SipiIO {
private:
public:
virtual ~SipiIOJ2k() {};
/*!
* Method used to read an image file
*
Expand All @@ -60,7 +61,7 @@ namespace Sipi {
* \param[out] width Width of the image in pixels
* \param[out] height Height of the image in pixels
*/
bool getDim(std::string filepath, size_t &width, size_t &height);
Sipi::SipiImgInfo getDim(std::string filepath);

/*!
* Write a TIFF image to a file, stdout or to a memory buffer
Expand Down
4 changes: 3 additions & 1 deletion include/formats/SipiIOJpeg.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ namespace Sipi {
void parse_photoshop(SipiImage *img, char *data, int length);

public:
virtual ~SipiIOJpeg() {};

/*!
* Method used to read an image file
*
Expand All @@ -59,7 +61,7 @@ namespace Sipi {
* \param[out] width Width of the image in pixels
* \param[out] height Height of the image in pixels
*/
bool getDim(std::string filepath, size_t &width, size_t &height);
Sipi::SipiImgInfo getDim(std::string filepath);


/*!
Expand Down
4 changes: 3 additions & 1 deletion include/formats/SipiIOPng.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ namespace Sipi {

class SipiIOPng : public SipiIO {
public:
virtual ~SipiIOPng() {};

/*!
* Method used to read an image file
*
Expand All @@ -52,7 +54,7 @@ namespace Sipi {
* \param[out] width Width of the image in pixels
* \param[out] height Height of the image in pixels
*/
bool getDim(std::string filepath, size_t &width, size_t &height);
Sipi::SipiImgInfo getDim(std::string filepath);


/*!
Expand Down
7 changes: 4 additions & 3 deletions include/formats/SipiIOTiff.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ namespace Sipi {
unsigned char *cvrt8BitTo1bit(const SipiImage &img, unsigned int &sll);

public:
virtual ~SipiIOTiff() {};

static void initLibrary(void);

/*!
Expand All @@ -100,10 +102,9 @@ namespace Sipi {
* Get the dimension of the image
*
* \param[in] filepath Pathname of the image file
* \param[out] width Width of the image in pixels
* \param[out] height Height of the image in pixels
* \return Image information
*/
bool getDim(std::string filepath, size_t &width, size_t &height);
SipiImgInfo getDim(std::string filepath);


/*!
Expand Down
Loading