MetadataCollection

This class represents a collection of metadata attributes. It can be accessed via Binary#metadata.

Instance method summary

  • Retrieves the value of a metadata attribute.

Metadata attributes

General metadata attributes

All binaries have the contentLengthcontentType, and filename metadata attributes. PDF documents and images have further attributes specific to their type.

If not specified otherwise, the attributes contain string values.

  • contentLength (Number) - Size of the file in bytes.
  • contentType - MIME type of the given file.
  • filename - The file basename, including the file extension.

Metadata attributes of PDF binaries

  • text - Text content of the PDF document.

Metadata attributes of image binaries

  • width (Number) - Width in pixels.
  • height (Number) - Height in pixels.

Only logged in users can access the complete set of metadata attributes. Regular website visitors can only see the contentLengthcontentTypefilenameheight, text, and width attributes.

Metadata available to logged-in users

The metadata attributes prefixed with iptc or exif are extracted from the image itself and may therefore not be available for every image. Both iptc and exif are standardized formats supported by a wide array of software applications and hardware devices such as cameras and phones.

  • exifCopyright - Copyright of the image.
  • exifDateTime - The date at which the image was created.
  • iptcKeywords (Array<String>) - A list of keywords associated with the image.
  • iptcHeadline - The headline of the image.
  • iptcCopyright - Copyright of the image.
  • iptcByline - The name of the image creator.
  • iptcCredit - Contains the persons or companies that should be given credit.
  • iptcSource - The original copyright holder.
  • iptcProfile - The color profile of the image.
  • iptcCity - The city in which the image was created.
  • iptcState - The state in which the image was created.
  • iptcCountryName - The country in which the image was created.
  • iptcCountryCode - The code of the country in which the image was created.

Searching for metadata

Metadata is taken into account when searching. See the ObjSearch class for details.

Search for all JPEGs:

Copy
Scrivito.Obj.where('blob:contentType', 'equals', 'image/jpeg');

Search for wide images:

Copy
Scrivito.Obj.where('blob:width', 'isGreaterThan', 1024);