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-
-
-
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- aPhysicalElementobject.pageType- aPageTypeobject.- Returns:
- a
Stringobject.
-
getImageUrl
-
getImageUrl
- Parameters:
pageType-pi-filepath-filename-- 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- aPhysicalElementobject.- Returns:
- a
Stringobject.
-
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- aPhysicalElementobject.pageType-- 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-- 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- aPhysicalElementobject.- 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- aStringobject.- Returns:
- a
ImageInformationobject. - Throws:
URISyntaxException- if any.de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException- if any.
-
isExternalUrl
isExternalUrl.
- Parameters:
path- aStringobject.- 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- aStringobject.- Returns:
- true if the path is an external url which has restricted access and must therefore be delivered via the contenetServer
-