alfresco-ng2-components/docs/core/thumbnail.service.md
Andy Stark 36625c1af6 [ADF-2451] Reviewed component docs (#3108)
* [ADF-2451] Reviewed component docs

* [ADF-2451] Reviewed component docs

* [ADF-2451] Renamed node share directive doc fileand rebuilt index
2018-03-22 09:34:26 +00:00

3.4 KiB
Raw Blame History

Added, Status, Last reviewed
Added Status Last reviewed
v2.0.0 Active 2018-03-21

Thumbnail service

Retrieves an SVG thumbnail image to represent a document type.

Methods

  • getDocumentThumbnailUrl(node: any): string
    Gets a thumbnail URL for the given document node.
    • node - Node to get URL for.
  • getMimeTypeIcon(mimeType: string): string
    Gets a thumbnail URL for a MIME type.
    • mimeType - MIME type for the thumbnail
  • getDefaultMimeTypeIcon(): string
    Gets a "miscellaneous" thumbnail URL for types with no other icon defined.

Details

The service can locate a thumbnail icon (in SVG format) for either a document node or a MIME type. The default mapping between types and icons is shown in the table below:

Document Icon Types
Compressed archive Archive thumbnail 'application/x-compressed', 'application/x-zip-compressed', 'application/zip'
Text Text thumbnail 'text/plain', 'application/json', 'application/x-javascript', 'application/vnd.apple.pages'
Bitmap/raster image Bitmap thumbnail 'image/png', 'image/jpeg', 'image/gif'
MP4 video MP4 thumbnail 'video/mp4'
SVG vector image SVG thumbnail 'image/svg+xml'
HTML file HTML thumbnail 'text/html'
PDF file PDF thumbnail 'application/pdf'
Folder Folder thumbnail
Disabled folder Disabled folder thumbnail
Excel spreadsheet Spreadsheet thumbnail 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.spreadsheetml.template'
PowerPoint slideshow PowerPoint thumbnail 'application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'application/vnd.openxmlformats-officedocument.presentationml.template', 'application/vnd.openxmlformats-officedocument.presentationml.slideshow'
Word document Word thumbnail 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.wordprocessingml.template'
Keynote presentation Keynote thumbnail 'application/vnd.apple.keynote'
Numbers spreadsheet Numbers thumbnail 'application/vnd.apple.numbers'

Mat-icon

All the ADF icons for MIME types are now registered into the MatIconRegistry, so you can use all the icons via the <mat-icon> tag:

import { ThumbnailService } from '@alfresco/adf-core';

constructor(public thumbnailService: ThumbnailService) {
}
MP4 <mat-icon svgIcon="video/mp4"></mat-icon>
PDF <mat-icon svgIcon="application/pdf"></mat-icon>
GIF <mat-icon svgIcon="image/gif"></mat-icon>
.....

See also