ChatiumFor developersPlaygroundPricing
Sign in

FilePreview

Properties

  • width (number):
    The width of the preview in pixels. Default: 32.
  • height (number):
    The height of the preview in pixels. Default: 32.
  • url (string):
    Direct URL for uploading or displaying the file. If provided, it will be used to create the background of the preview.
  • hash (string):
    File hash used to obtain the thumbnail URL through the getThumbnailUrl function. If the url is not specified, the thumbnail is created based on the hash.
  • name (string):
    File name. Used to provide information in HTML data attributes.
  • size (number):
    File size (in bytes). Default: 0.
  • type (string):
    File type (e.g., MIME type). Used to provide information in HTML data attributes.

Important Points

  • createMemo:
    Memoization of the URL calculation for the thumbnail. If a url is provided, it is used. If there is no url, but there is a hash, the getThumbnailUrl function is called, which returns the thumbnail URL based on the hash and preview dimensions.
  • htmlEscape:
    A function used to escape the file name and file type to avoid potential XSS vulnerabilities.