Class ThumbnailHandler
java.lang.Object
io.goobi.viewer.controller.imaging.ThumbnailHandler
Delivers Thumbnail urls for pages and StructElements.
- Author:
- Florian Alpers
-
Field Summary
Modifier and TypeFieldDescriptionConstantREQUIRED_SOLR_FIELDS
. -
Constructor Summary
ConstructorDescriptionThumbnailHandler
(IIIFUrlHandler iiifUrlHandler, String staticImagesPath) Constructor for ThumbnailHandler.ThumbnailHandler
(URI apiUrl, String staticImagesPath) -
Method Summary
Modifier and TypeMethodDescriptiongetAnchorImagePath
(StructElement doc, String thumbnailUrl, String anchorThumbnailMode) static String
getCMSMediaImageApiUrl
(String filename) static String
getCMSMediaImageApiUrl
(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.ImageFileFormat
getImageFileFormat
(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.getPage.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 givenCMSMediaItem
of the default size.getSquareThumbnailUrl
(CMSMediaItem media, int size) Return the url to the image of the givenCMSMediaItem
of 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 givenCMSMediaItem
of the default size.getSquareThumbnailUrl
(Optional<CMSMediaItem> optional, int size) Return the url to the image of the givenCMSMediaItem
of 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.boolean
isStaticImageResource
(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
- aIIIFUrlHandler
object.staticImagesPath
- aString
object.
-
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
- aPhysicalElement
object.- Returns:
- a
String
object.
-
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 PhysicalElement getPage(String pi, int order) throws IndexUnreachableException, PresentationException, DAOException getPage.
- Parameters:
pi
- aString
object.order
- a int.- Returns:
- a
PhysicalElement
object. - 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
- aPhysicalElement
object.width
- a int.height
- a int.- Returns:
- a
String
object.
-
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
- aPhysicalElement
object.width
- a int.height
- a int.format
- the file extension of the desiref format. Possible values are 'jpg', 'tif' and 'png'- Returns:
- a
String
object.
-
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
- aPhysicalElement
object.scale
- aScale
object.- Returns:
- a
String
object.
-
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
- aPhysicalElement
object.scale
- aScale
object.format
- the file extension of the desired format. Possible values are 'jpg', 'tif' and 'png'- Returns:
- a
String
object.
-
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
- aPhysicalElement
object.- Returns:
- a
String
object.
-
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
- aPhysicalElement
object.size
- a int.- Returns:
- a
String
object.
-
getThumbnailUrl
Returns a link to a small image representing the given document. The size depends on viewer configuration.- Parameters:
doc
- aStructElement
object.- Returns:
- a
String
object.
-
getThumbnailUrl
Returns a link to a small image representing the given document with the given pi. The size depends on viewer configuration.- Parameters:
doc
- aStructElement
object.pi
- aString
object.- Returns:
- a
String
object.
-
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
- aSolrDocument
object.- Returns:
- a
String
object. - 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
- aSolrDocument
object.- Returns:
- a
String
object. - 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
- aSolrDocument
object.width
- a int.height
- a int.- Returns:
- a
String
object. - 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
- aSolrDocument
object.size
- a int.- Returns:
- a
String
object. - 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.MIMETYPE
andSolrConstants.THUMBNAIL
width
- a int.height
- a int.- Returns:
- a
String
object.
-
getThumbnailUrl
getThumbnailUrl.
- Parameters:
doc
- aStructElement
object.pi
- aString
object.width
- a int.height
- a int.- Returns:
- a
String
object.
-
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
- aPhysicalElement
object.scale
- aScale
object.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
String
object.
-
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
- aStructElement
object.- Returns:
- a
String
object.
-
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.MIMETYPE
andSolrConstants.THUMBNAIL
size
- a int.- Returns:
- a
String
object.
-
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
- aCMSMediaItem
object.- Returns:
- a
String
object.
-
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:
width
- a int.height
- a int.media
- aCMSMediaItem
object.- Returns:
- a
String
object.
-
getSquareThumbnailUrl
Return the url to the image of the givenCMSMediaItem
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. -
getSquareThumbnailUrl
Return the url to the image of the givenCMSMediaItem
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:
size
- a int.media
- aCMSMediaItem
object.- Returns:
- a
String
object.
-
getSquareThumbnailUrl
Return the url to the image of the givenCMSMediaItem
of 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 givenCMSMediaItem
of 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
- aCMSMediaItem
object.- Returns:
- a
String
object.
-
isStaticImageResource
Tests whether the given url refers to an image within the viewer image resource folder.- Parameters:
thumbnailUrl
- aString
object.- Returns:
- true if the url starts with the viewer url path to image resources
-