README.md 2.37 KB
Newer Older
1
2
3
4
5
6
Repository Image manipulation service
=====================================

This comprises an image manipulation service used in combination with ImageMagick's `convert` utility.
This service assumes that ImageMagick is installed somewhere.

acoburn's avatar
acoburn committed
7
The endpoint location is configurable. The `options` parameter can be used to add output parameters
8
to ImageMagick. The `Accept` header is used to change the format of the image. By default,
acoburn's avatar
acoburn committed
9
10
11
the output is JPEG, but any format listed in the configuration under `valid.formats` can be used.
By default, the valid output formats are `image/tiff`, `image/jp2` and `image/jpeg`.

Aaron Coburn's avatar
Aaron Coburn committed
12
A `context` parameter is used to define the path to the LDP resource. Alternately, the
acoburn's avatar
acoburn committed
13
14
`Apix-Ldp-Resource-Path` header may be used to identify the resource path.

acoburn's avatar
acoburn committed
15
16
An example:

acoburn's avatar
acoburn committed
17
    curl "http://localhost:9081/image?context=http://localhost:8080/fcrepo/rest/image/resource&options=-resize%20400x400" -H"Accept: image/jpeg"
acoburn's avatar
acoburn committed
18
19

The service is defined to operate on any `fedora:Binary` resources with a MIMEType of `image/*`.
20
21
22
23
24
25

Building
--------

To build this project use

26
    gradle install
27
28
29
30
31
32
33
34
35

Deploying in OSGi
-----------------

This projects can be deployed in an OSGi container. For example using
[Apache Karaf](http://karaf.apache.org) version 4.x or better, you can run the following
command from its shell:

    feature:repo-add mvn:edu.amherst.acdc/acrepo-karaf/LATEST/xml/features
36
    feature:install acrepo-exts-image
37
38
39
40
41

Configuration
-------------

The application can be configured by creating the following configuration
42
file `$KARAF_HOME/etc/edu.amherst.acdc.exts.image.cfg`. The following values
43
44
45
46
47
48
49
50
51
52
53
54
are available for configuration:

The base url of the fedora repository and any authentication parameters

    fcrepo.baseUrl=localhost:8080/fcrepo/rest
    fcrepo.authUsername=
    fcrepo.authPassword=

The acceptable output formats for images

    valid.formats=jpeg,jp2,tiff

acoburn's avatar
acoburn committed
55
56
57
58
The default output format, when no `Accept` header is supplied

    default.format=jpeg

59
60
61
62
63
64
The path to the `convert` utility

    convert.path=convert

The port on which the service is made availalbe

65
    rest.port=9105
66
67
68
69
70
71
72
73
74
75
76
77
78
79

The hostname on which the service is available

    rest.host=localhost

The prefix for the service

    rest.prefix=/image

By editing this file, any currently running routes will be immediately redeployed
with the new values.

For more help see the [Apache Camel](http://camel.apache.org) documentation