Class ThumbnailHandler
java.lang.Object
io.goobi.viewer.controller.imaging.ThumbnailHandler
Delivers Thumbnail urls for pages and StructElements.
- Author:
- Florian Alpers
-
Field Summary
FieldsModifier and TypeFieldDescriptionConstantREQUIRED_SOLR_FIELDS. -
Constructor Summary
ConstructorsConstructorDescriptionThumbnailHandler(IIIFUrlHandler iiifUrlHandler, String staticImagesPath) Constructor for ThumbnailHandler.ThumbnailHandler(URI apiUrl, String staticImagesPath) -
Method Summary
Modifier and TypeMethodDescriptiongetAnchorImagePath(StructElement doc, String thumbnailUrl, String anchorThumbnailMode) static StringgetCMSMediaImageApiUrl(String filename) static StringgetCMSMediaImageApiUrl(String filename, String restApiUrl) getCMSPageImagePath(StructElement doc, String thumbnailUrl) getDocStructImagePath(StructElement doc, String thumbnailUrl) getDocumentImagePath(StructElement doc, String thumbnailUrl) getFullImageUrl.getFullImageUrl(PhysicalElement page, de.unigoettingen.sub.commons.contentlib.imagelib.transform.Scale scale, String formatString) getFullImageUrl.static de.unigoettingen.sub.commons.contentlib.imagelib.ImageFileFormatgetImageFileFormat(PhysicalElement page, String format) getImageUrl(PhysicalElement page, int width, int height, String format) Returns a link to an image representing the given page of the given size (to be exact: the largest image size which fits within the given bounds and keeps the image proportions.getImageUrl(PhysicalElement page, de.unigoettingen.sub.commons.contentlib.imagelib.transform.Scale scale, de.unigoettingen.sub.commons.contentlib.imagelib.ImageFileFormat format) getThumbnailUrl.getImageUrl(String pi, int width, int height, String format) Returns a link to the representative image for the given pi with the given width and height.static PhysicalElementgetPage.getSquareThumbnailUrl(int order, String pi) Returns a link to a square image of the page of the given order (=page number) within the work with the given pi.getSquareThumbnailUrl(int order, String pi, int size) Returns a link to a square image of the page of the given order (=page number) within the work with the given pi of the given size.Return the url to the image of the givenCMSMediaItemof the default size.getSquareThumbnailUrl(CMSMediaItem media, int size) Return the url to the image of the givenCMSMediaItemof the given size.Returns a link the an image representing the given page.getSquareThumbnailUrl(PhysicalElement page, int size) Returns a link the an image representing the given page of the given size.Returns a link the an image representing the given document.getSquareThumbnailUrl(StructElement se, int size) Returns a link the an image representing the given document of the given size.Returns a link to a square representative image for the given pi.getSquareThumbnailUrl(String pi, int size) Returns a link to a square representative image for the given pi.getSquareThumbnailUrl(URI baseUri) Get the square thumbnailUrl for a IIIF image identifier with default size.getSquareThumbnailUrl(URI baseUri, int size) Get the square thumbnailUrl for a IIIF image identifier.Return the url to the image of the givenCMSMediaItemof the default size.getSquareThumbnailUrl(Optional<CMSMediaItem> optional, int size) Return the url to the image of the givenCMSMediaItemof the given size.getSquareThumbnailUrl(org.apache.solr.common.SolrDocument doc) Returns a link to a small image representing the given document.getSquareThumbnailUrl(org.apache.solr.common.SolrDocument doc, int size) Returns a link to an image representing the given page of the given size.getThumbnailPath(String filename) getThumbnailPath.getThumbnailUrl(int order, String pi) Returns a link to the image of the page of the given order (=page number) within the work with the given pi .getThumbnailUrl(int order, String pi, int width, int height) Returns a link to the image of the page of the given order (=page number) within the work with the given pi of the given width and height.getThumbnailUrl(CMSMediaItem item) Return the url to the image of the givenCMSMediaItem, fit into a box of the default width and height.getThumbnailUrl(CMSMediaItem media, int width, int height) Return the url to the image of the givenCMSMediaItem, fit into a box of the given width and height.Returns a link to a small image representing the given page.getThumbnailUrl(PhysicalElement page, int width, int height) Returns a link to an image representing the given page of the given size (to be exact: the largest image size which fits within the given bounds and keeps the image proportions.getThumbnailUrl(PhysicalElement page, de.unigoettingen.sub.commons.contentlib.imagelib.transform.Scale scale) getThumbnailUrl.Returns a link to a small image representing the given document.getThumbnailUrl(StructElement se, int width, int height) Returns a link to an image representing the given document of the given size (to be exact: the largest image size which fits within the given bounds and keeps the image proportions.getThumbnailUrl(StructElement doc, String pi) Returns a link to a small image representing the given document with the given pi.getThumbnailUrl(StructElement doc, String pi, int width, int height) getThumbnailUrl.Returns a link to the representative image for the given pi.getThumbnailUrl(String pi, int width, int height) Returns a link to the representative image for the given pi with the given width and height.getThumbnailUrl(URI baseUri) Get the thumbnailUrl for a IIIF image identifier with default size.getThumbnailUrl(URI baseUri, int width, int height) Get the thumbnailUrl for a IIIF image identifier.getThumbnailUrl(URI baseUri, int width, int height, boolean square) Get the thumbnailUrl for a IIIF image identifier.getThumbnailUrl(Optional<CMSMediaItem> item) Return the url to the image of the givenCMSMediaItem, fit into a box of the default width and height.getThumbnailUrl(Optional<CMSMediaItem> optional, int width, int height) Return the url to the image of the givenCMSMediaItem, fit into a box of the given width and height.getThumbnailUrl(org.apache.solr.common.SolrDocument doc) Returns a link to a small image representing the given document.getThumbnailUrl(org.apache.solr.common.SolrDocument doc, int width, int height) Returns a link to an image representing the given page of the given size (to be exact: the largest image size which fits within the given bounds and keeps the image proportions.booleanisStaticImageResource(String thumbnailUrl) Tests whether the given url refers to an image within the viewer image resource folder.
-
Field Details
-
REQUIRED_SOLR_FIELDS
ConstantREQUIRED_SOLR_FIELDS.
-
-
Constructor Details
-
ThumbnailHandler
Constructor for ThumbnailHandler.
- Parameters:
iiifUrlHandler- aIIIFUrlHandlerobject.staticImagesPath- aStringobject.
-
ThumbnailHandler
-
-
Method Details
-
getThumbnailPath
getThumbnailPath.
-
getThumbnailUrl
Returns a link to a small image representing the given page. The size depends on viewer configuration.- Parameters:
page- aPhysicalElementobject.- Returns:
- a
Stringobject.
-
getThumbnailUrl
public String getThumbnailUrl(String pi) throws IndexUnreachableException, PresentationException, ViewerConfigurationException Returns a link to the representative image for the given pi. If the pi doesn't match an indexed item, null is returned.- Parameters:
pi- the persistent identifier of the work which representative we want- Returns:
- The url string or null of no work is found
- Throws:
IndexUnreachableException- if any.PresentationException- if any.ViewerConfigurationException- if any.
-
getThumbnailUrl
public String getThumbnailUrl(String pi, int width, int height) throws IndexUnreachableException, PresentationException, ViewerConfigurationException Returns a link to the representative image for the given pi with the given width and height. If the pi doesn't match an indexed item, null is returned- Parameters:
pi- the persistent identifier of the work which representative we wantwidth- the width of the imageheight- the height of the image- Returns:
- The url string or null of no work is found
- Throws:
IndexUnreachableException- if any.PresentationException- if any.ViewerConfigurationException- if any.
-
getImageUrl
public String getImageUrl(String pi, int width, int height, String format) throws IndexUnreachableException, PresentationException, ViewerConfigurationException Returns a link to the representative image for the given pi with the given width and height. If the pi doesn't match an indexed item, null is returned- Parameters:
pi- the persistent identifier of the work which representative we wantwidth- the width of the imageheight- the height of the imageformat- the file extension of the desired format. Possible values are 'jpg', 'tif' and 'png'- Returns:
- The url string or null of no work is found
- Throws:
IndexUnreachableException- if any.PresentationException- if any.ViewerConfigurationException- if any.
-
getSquareThumbnailUrl
public String getSquareThumbnailUrl(String pi) throws IndexUnreachableException, PresentationException, ViewerConfigurationException Returns a link to a square representative image for the given pi. If the pi doesn't match an indexed item, null is returned.- Parameters:
pi- the persistent identifier of the work which representative we want- Returns:
- The url string or null of no work is found
- Throws:
IndexUnreachableException- if any.PresentationException- if any.ViewerConfigurationException- if any.
-
getSquareThumbnailUrl
public String getSquareThumbnailUrl(String pi, int size) throws IndexUnreachableException, PresentationException, ViewerConfigurationException Returns a link to a square representative image for the given pi. If the pi doesn't match an indexed item, null is returned.- Parameters:
pi- the persistent identifier of the work which representative we wantsize- the size (width and heigt) of the image- Returns:
- The url string or null of no work is found
- Throws:
IndexUnreachableException- if any.PresentationException- if any.ViewerConfigurationException- if any.
-
getThumbnailUrl
public String getThumbnailUrl(int order, String pi) throws IndexUnreachableException, PresentationException, DAOException, ViewerConfigurationException Returns a link to the image of the page of the given order (=page number) within the work with the given pi . If the pi doesn't match an indexed work or the work desn't contain a page of the given order, null is returned.- Parameters:
order- the page numberpi- the persistent identifier of the work which representative we want- Returns:
- The url string or null of no work is found
- Throws:
IndexUnreachableException- if any.PresentationException- if any.DAOException- if any.ViewerConfigurationException- if any.
-
getThumbnailUrl
public String getThumbnailUrl(int order, String pi, int width, int height) throws ViewerConfigurationException Returns a link to the image of the page of the given order (=page number) within the work with the given pi of the given width and height. If the pi doesn't match an indexed work or the work desn't contain a page of the given order, null is returned.- Parameters:
order- the page numberpi- the persistent identifier of the work which representative we wantwidth- the width of the imageheight- the height of the image- Returns:
- The url string or null of no work is found
- Throws:
IndexUnreachableException- if any.PresentationException- if any.DAOException- if any.ViewerConfigurationException- if any.
-
getSquareThumbnailUrl
public String getSquareThumbnailUrl(int order, String pi) throws IndexUnreachableException, PresentationException, DAOException, ViewerConfigurationException Returns a link to a square image of the page of the given order (=page number) within the work with the given pi. If the pi doesn't match an indexed work or the work desn't contain a page of the given order, null is returned.- Parameters:
order- the page numberpi- the persistent identifier of the work which representative we want- Returns:
- The url string or null of no work is found
- Throws:
IndexUnreachableException- if any.PresentationException- if any.DAOException- if any.ViewerConfigurationException- if any.
-
getSquareThumbnailUrl
public String getSquareThumbnailUrl(int order, String pi, int size) throws IndexUnreachableException, PresentationException, DAOException, ViewerConfigurationException Returns a link to a square image of the page of the given order (=page number) within the work with the given pi of the given size. If the pi doesn't match an indexed work or the work desn't contain a page of the given order, null is returned.- Parameters:
order- the page numberpi- the persistent identifier of the work which representative we wantsize- the width and height of the image- Returns:
- The url string or null of no work is found
- Throws:
IndexUnreachableException- if any.PresentationException- if any.DAOException- if any.ViewerConfigurationException- if any.
-
getPage
public static PhysicalElement getPage(String pi, int order) throws IndexUnreachableException, PresentationException, DAOException getPage.
- Parameters:
pi- aStringobject.order- a int.- Returns:
- a
PhysicalElementobject. - Throws:
IndexUnreachableException- if any.PresentationException- if any.DAOException- if any.
-
getThumbnailUrl
Returns a link to an image representing the given page of the given size (to be exact: the largest image size which fits within the given bounds and keeps the image proportions.- Parameters:
page- aPhysicalElementobject.width- a int.height- a int.- Returns:
- a
Stringobject.
-
getImageUrl
Returns a link to an image representing the given page of the given size (to be exact: the largest image size which fits within the given bounds and keeps the image proportions.- Parameters:
page- aPhysicalElementobject.width- a int.height- a int.format- the file extension of the desiref format. Possible values are 'jpg', 'tif' and 'png'- Returns:
- a
Stringobject.
-
getImageFileFormat
public static de.unigoettingen.sub.commons.contentlib.imagelib.ImageFileFormat getImageFileFormat(PhysicalElement page, String format) -
getThumbnailUrl
public String getThumbnailUrl(PhysicalElement page, de.unigoettingen.sub.commons.contentlib.imagelib.transform.Scale scale) getThumbnailUrl.
- Parameters:
page- aPhysicalElementobject.scale- aScaleobject.- Returns:
- a
Stringobject.
-
getImageUrl
public String getImageUrl(PhysicalElement page, de.unigoettingen.sub.commons.contentlib.imagelib.transform.Scale scale, de.unigoettingen.sub.commons.contentlib.imagelib.ImageFileFormat format) getThumbnailUrl.
- Parameters:
page- aPhysicalElementobject.scale- aScaleobject.format- the file extension of the desired format. Possible values are 'jpg', 'tif' and 'png'- Returns:
- a
Stringobject.
-
getSquareThumbnailUrl
Returns a link the an image representing the given page. Its size depends on configuration. The image is always square and contains as much of the actual image as is possible to fit into a square - the delivered square is always centered within the full image.- Parameters:
page- aPhysicalElementobject.- Returns:
- a
Stringobject.
-
getSquareThumbnailUrl
Returns a link the an image representing the given page of the given size. The image is always square and contains as much of the actual image as is possible to fit into a square - the delivered square is always centered within the full image.- Parameters:
page- aPhysicalElementobject.size- a int.- Returns:
- a
Stringobject.
-
getThumbnailUrl
Returns a link to a small image representing the given document. The size depends on viewer configuration.- Parameters:
doc- aStructElementobject.- Returns:
- a
Stringobject.
-
getThumbnailUrl
Returns a link to a small image representing the given document with the given pi. The size depends on viewer configuration.- Parameters:
doc- aStructElementobject.pi- aStringobject.- Returns:
- a
Stringobject.
-
getThumbnailUrl
public String getThumbnailUrl(org.apache.solr.common.SolrDocument doc) throws ViewerConfigurationException Returns a link to a small image representing the given document. The size depends on viewer configuration.- Parameters:
doc- aSolrDocumentobject.- Returns:
- a
Stringobject. - Throws:
ViewerConfigurationException- if any.
-
getSquareThumbnailUrl
public String getSquareThumbnailUrl(org.apache.solr.common.SolrDocument doc) throws ViewerConfigurationException Returns a link to a small image representing the given document. The size depends on viewer configuration. The image may be cut at the longer side to provide a square image.- Parameters:
doc- aSolrDocumentobject.- Returns:
- a
Stringobject. - Throws:
ViewerConfigurationException- if any.
-
getThumbnailUrl
public String getThumbnailUrl(org.apache.solr.common.SolrDocument doc, int width, int height) throws ViewerConfigurationException Returns a link to an image representing the given page of the given size (to be exact: the largest image size which fits within the given bounds and keeps the image proportions.- Parameters:
doc- aSolrDocumentobject.width- a int.height- a int.- Returns:
- a
Stringobject. - Throws:
ViewerConfigurationException- if any.
-
getSquareThumbnailUrl
public String getSquareThumbnailUrl(org.apache.solr.common.SolrDocument doc, int size) throws ViewerConfigurationException Returns a link to an image representing the given page of the given size. The image will be cut at the longer side to create a square image.- Parameters:
doc- aSolrDocumentobject.size- a int.- Returns:
- a
Stringobject. - Throws:
ViewerConfigurationException- if any.
-
getThumbnailUrl
Returns a link to an image representing the given document of the given size (to be exact: the largest image size which fits within the given bounds and keeps the image proportions.- Parameters:
se- Needs to have the fieldsSolrConstants.MIMETYPEandSolrConstants.THUMBNAILwidth- a int.height- a int.- Returns:
- a
Stringobject.
-
getThumbnailUrl
getThumbnailUrl.
- Parameters:
doc- aStructElementobject.pi- aStringobject.width- a int.height- a int.- Returns:
- a
Stringobject.
-
getFullImageUrl
getFullImageUrl.
- Parameters:
page- a {)@link io.goobi.viewer.model.viewer.PhysicalElement} object.- Returns:
- the url of the entire, max-size image in the original format. If no Watermark needs to be included and forwarding images is allowed in contentServer, then this streams the original image file to the client
-
getFullImageUrl
public String getFullImageUrl(PhysicalElement page, de.unigoettingen.sub.commons.contentlib.imagelib.transform.Scale scale, String formatString) getFullImageUrl.
- Parameters:
page- aPhysicalElementobject.scale- aScaleobject.formatString- file extension for the desired format. May also be 'master' to indicate that the format of the original file should be used- Returns:
- a
Stringobject.
-
getSquareThumbnailUrl
Returns a link the an image representing the given document. Its size depends on configuration. The image is always square and contains as much of the actual image as is possible to fit into a square - the delivered square is always centered within the full image.- Parameters:
se- aStructElementobject.- Returns:
- a
Stringobject.
-
getSquareThumbnailUrl
Returns a link the an image representing the given document of the given size. The image is always square and contains as much of the actual image as is possible to fit into a square - the delivered square is always centered within the full image.- Parameters:
se- Needs to have the fieldsSolrConstants.MIMETYPEandSolrConstants.THUMBNAILsize- a int.- Returns:
- a
Stringobject.
-
getDocumentImagePath
- Parameters:
doc-thumbnailUrl-- Returns:
- String
-
getDocStructImagePath
- Parameters:
doc-thumbnailUrl-- Returns:
String
-
getAnchorImagePath
public String getAnchorImagePath(StructElement doc, String thumbnailUrl, String anchorThumbnailMode) - Parameters:
doc-thumbnailUrl-anchorThumbnailMode-- Returns:
String
-
getCMSPageImagePath
- Parameters:
doc-thumbnailUrl-- Returns:
- String
-
getThumbnailUrl
Return the url to the image of the givenCMSMediaItem, fit into a box of the default width and height. -
getThumbnailUrl
Return the url to the image of the givenCMSMediaItem, fit into a box of the default width and height.- Parameters:
item- aCMSMediaItemobject.- Returns:
- a
Stringobject.
-
getThumbnailUrl
Return the url to the image of the givenCMSMediaItem, fit into a box of the given width and height. -
getThumbnailUrl
Get the thumbnailUrl for a IIIF image identifier with default size.- Parameters:
baseUri- IIIF image identifier- Returns:
- Generated URL
-
getThumbnailUrl
Get the thumbnailUrl for a IIIF image identifier.- Parameters:
baseUri- IIIF image identifierwidth- thumbnail widthheight- thumbnail height- Returns:
- Generated URL
-
getSquareThumbnailUrl
Get the square thumbnailUrl for a IIIF image identifier with default size.- Parameters:
baseUri- IIIF image identifier- Returns:
- Generated URL
-
getSquareThumbnailUrl
Get the square thumbnailUrl for a IIIF image identifier.- Parameters:
baseUri- IIIF image identifiersize- thumbnail size- Returns:
- Generated URL
-
getThumbnailUrl
Get the thumbnailUrl for a IIIF image identifier.- Parameters:
baseUri- IIIF image identifierwidth- thumbnail widthheight- thumbnail heightsquare- true to deliver a square image- Returns:
- Generated URL
-
getCMSMediaImageApiUrl
- Parameters:
filename-- Returns:
- Generated URL
-
getCMSMediaImageApiUrl
-
getThumbnailUrl
Return the url to the image of the givenCMSMediaItem, fit into a box of the given width and height.- Parameters:
media- aCMSMediaItemobject.width- a int.height- a int.- Returns:
- a
Stringobject.
-
getSquareThumbnailUrl
Return the url to the image of the givenCMSMediaItemof the given size. The image is always square and contains as much of the actual image as is possible to fit into a square - the delivered square is always centered within the full image. -
getSquareThumbnailUrl
Return the url to the image of the givenCMSMediaItemof the given size. The image is always square and contains as much of the actual image as is possible to fit into a square - the delivered square is always centered within the full image.- Parameters:
media- aCMSMediaItemobject.size- a int.- Returns:
- a
Stringobject.
-
getSquareThumbnailUrl
Return the url to the image of the givenCMSMediaItemof the default size. The image is always square and contains as much of the actual image as is possible to fit into a square - the delivered square is always centered within the full image.n -
getSquareThumbnailUrl
Return the url to the image of the givenCMSMediaItemof the default size. The image is always square and contains as much of the actual image as is possible to fit into a square - the delivered square is always centered within the full image.- Parameters:
item- aCMSMediaItemobject.- Returns:
- a
Stringobject.
-
isStaticImageResource
Tests whether the given url refers to an image within the viewer image resource folder.- Parameters:
thumbnailUrl- aStringobject.- Returns:
- true if the url starts with the viewer url path to image resources
-