Class ImageHandler
java.lang.Object
io.goobi.viewer.controller.imaging.ImageHandler
Provides urls to download pdfs, images and image footer.
- Author:
- Florian Alpers
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetIIIFBaseUrl(String url) Get the IIIF base url (resource id) from an iiif info.json url or a iiif image url.de.intranda.api.iiif.image.ImageInformationgetImageInformation.de.intranda.api.iiif.image.ImageInformationgetImageInformation(PhysicalElement page, PageType pageType) getImageInformation.de.intranda.api.iiif.image.ImageInformationgetImageInformation.getImageUrl(PageType pageType, String pi, String filepath) getImageUrl(PageType pageType, String pi, String filepath, String filename) getImageUrl(PhysicalElement page) Returns the image link for the given page.getImageUrl(PhysicalElement page, PageType pageType) Returns the image link for the given page and pageType.static booleanisExternalUrl(String path) isExternalUrl.protected static booleanisImageUrl(String url, boolean displayableTypesOnly) isImageUrl.static booleanisRestrictedUrl(String path) isRestrictedUrl.
-
Constructor Details
-
ImageHandler
public ImageHandler() -
ImageHandler
- Parameters:
contentUrlManager- API URL manager for building content and image resource URLs
-
-
Method Details
-
getImageUrl
Returns the image link for the given page and pageType. For external images, this links to the IIIF image information json+ls For external images, this may either also be a IIIF image information or the image itself- Parameters:
page- physical page providing the image filename and PIpageType- viewer page type used to select the appropriate URL pattern- Returns:
- the IIIF image info URL for the given page and page type
-
getImageUrl
-
getImageUrl
- Parameters:
pageType- viewer page type used to select the appropriate URL patternpi- persistent identifier of the recordfilepath- relative or full path to the image filefilename- image filename used for URL construction- Returns:
- Generated URL
-
getImageUrl
Returns the image link for the given page. For external images, this links to the IIIF image information json+ls For external images, this may either also be a IIIF image information or the image itself- Parameters:
page- physical page providing the image filename and PI- Returns:
- the IIIF image info URL for the given page using the default viewImage page type
-
getImageInformation
public de.intranda.api.iiif.image.ImageInformation getImageInformation(PhysicalElement page, PageType pageType) throws de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException, ViewerConfigurationException, URISyntaxException, IndexUnreachableException, DAOException getImageInformation.- Parameters:
page- physical page providing image dimensions and access permissionspageType- page type determining tile and zoom configuration- Returns:
- The image information for the image file of the given page
- Throws:
de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException- if any.URISyntaxException- if any.PresentationException- if any.IndexUnreachableException- if any.ViewerConfigurationExceptionDAOException
-
getIIIFBaseUrl
Get the IIIF base url (resource id) from an iiif info.json url or a iiif image url. If the given url does not match a iiif image resource pattern, return the unchanged url- Parameters:
url- IIIF image info.json or image URL to extract the base URL from- Returns:
- the base url/id of the given iiif image resource.
-
getImageInformation
public de.intranda.api.iiif.image.ImageInformation getImageInformation(PhysicalElement page) throws de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException, URISyntaxException, PresentationException, IndexUnreachableException getImageInformation.- Parameters:
page- physical page whose image file is read- Returns:
- The image information for the image file of the given page
- Throws:
de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException- if any.URISyntaxException- if any.PresentationException- if any.IndexUnreachableException- if any.
-
getImageInformation
public de.intranda.api.iiif.image.ImageInformation getImageInformation(String url) throws URISyntaxException, de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException getImageInformation.- Parameters:
url- IIIF image or info.json URL to retrieve image information from- Returns:
- the IIIF ImageInformation for the resolved image URL
- Throws:
URISyntaxException- if any.de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException- if any.
-
isExternalUrl
isExternalUrl.- Parameters:
path- file path or URL to test- Returns:
- true exactly if the given path starts with
http://orhttps://
-
isImageUrl
isImageUrl.- Parameters:
url- aStringobject.displayableTypesOnly- if true, the method only returns true for images that can be directly displayed in a browser (jpg and png)- Returns:
- true if the url ends with an image file suffix
-
isRestrictedUrl
isRestrictedUrl.- Parameters:
path- file path or URL to test against configured restricted patterns- Returns:
- true if the path is an external url which has restricted access and must therefore be delivered via the contenetServer
-