Class: Scrivito::MetaDataCollection

Inherits:
Object
  • Object
show all
Defined in:
app/cms/scrivito/meta_data_collection.rb

Overview

This class represents a collection of meta data attributes.

Available meta data attributes

All binaries have the meta attributes content_length, content_type and filename, in addition, PDFs and images have attributes specific to their type.

If not specified otherwise, the attributes contain string values.

[+content_length (Number)+] Size in bytes of the given file. [+content_type+] MIME-type of the given file. [+filename+] The file basename, including the file extension.

Available meta data attributes for PDFs

[+text+] Text content of the PDF document.

Available meta data attributes for Images

The meta data attributes starting with iptc_ or exif_ are extracted from the image itself and therefore may not be available for every image. Iptc and exif are both standardized formats supported by a wide array of software and hardware, like cameras and phones.

[+width (Number)+] Width in pixels. [+height (Number)+] Height in pixels. [+exif_copyright+] Copyright of the image. [+exif_date_time+] The date at which the image was produced.

[+iptc_keywords (Array)+ ] A list of keywords associated with the image. [+iptc_headline+] The headline of the image. [+iptc_copyright+] Copyright of the image. [+iptc_byline+] The name of the image creator. [+iptc_credit+] Contains the persons or companies that should be credited. [+iptc_source+] The original copyright holder. [+iptc_profile+] The color profile of the image. [+iptc_city+] The city in which the image was produced. [+iptc_state+] The state in which the image was produced. [+iptc_country_name+] The country in which the image was produced. [+iptc_country_code+] The code of the country in which the image was produced.

Searching for meta data

Meta data is taken into account when searching. See the ObjSearchEnumerator for details.

Examples:

Search for all JPEGs

Image.where('blob:content_type', :equals, 'image/jpeg')

Search for wide images

Image.where('blob:width', :is_greater_than, 1024)

Instance Method Summary collapse

Instance Method Details

#[](name) ⇒ String, ...

Find value of a meta data attribute.

Parameters:

  • name (Symbol, String)

    the name of the meta data attribute.

Returns:

  • (String, Array, Integer, Date, nil)

    meta data attribute value if found or nil otherwise.



65
66
67
# File 'app/cms/scrivito/meta_data_collection.rb', line 65

def [](name)
  @attributes[name]
end