Module z_media_identify

Identify files, fetch metadata about an image.

Copyright © 2009-2014 Marc Worrell

Authors: Marc Worrell (marc@worrell.nl).

Description

Identify files, fetch metadata about an image

Data Types

filename_extension()

filename_extension() = binary()

media_info()

media_info() = map()

mime_type()

mime_type() = binary()

optional_filename()

optional_filename() = undefined | file:filename_all()

Function Index

extension/1Return the extension for a known mime type (eg.
extension/2
extension/3Return the extension for a known mime type (eg.
guess_mime/1 Guess the mime type of a file by the extension of its filename.
identify/2Caching version of identify/3.
identify/3
identify/4
identify_file/2Fetch information about a file, returns mime, width, height, type, etc.
identify_file/3
identify_file_direct/2Fetch information about a file, returns mime, width, height, type, etc.
is_mime_compressed/1Given a mime type, return whether its file contents is already compressed or not.
is_mime_vector/1

Function Details

extension/1

extension(Mime::string() | binary()) -> filename_extension()

Return the extension for a known mime type (eg. ".mov").

extension/2

extension(Mime::string() | binary(), PreferExtension::string() | binary() | undefined) -> filename_extension()

extension/3

extension(Mime::string() | binary(), PreferExtension::string() | binary() | undefined, Context::z:context()) -> filename_extension()

Return the extension for a known mime type (eg. ".mov"). When multiple extensions are found for the given mime type, returns the one that is given as the preferred extension. Otherwise, it returns the first extension.

guess_mime/1

guess_mime(File::file:filename_all()) -> mime_type()

Guess the mime type of a file by the extension of its filename.

identify/2

identify(Upload::#upload{} | file:filename_all(), Context::z:context()) -> {ok, media_info()} | {error, term()}

Caching version of identify/3. Fetches information about an image, returns width, height, type, etc.

identify/3

identify(File::#upload{} | file:filename_all(), OriginalFilename::optional_filename(), Context::z:context()) -> {ok, media_info()} | {error, term()}

identify/4

identify(File, MediumFilename, OriginalFilename, Context) -> any()

identify_file/2

identify_file(File::file:filename_all(), Context::z:context()) -> {ok, media_info()} | {error, term()}

Fetch information about a file, returns mime, width, height, type, etc. First checks if a module has a specific identification methods.

identify_file/3

identify_file(File::file:filename_all(), OriginalFilename::optional_filename(), Context::z:context()) -> {ok, media_info()} | {error, term()}

identify_file_direct/2

identify_file_direct(File::file:filename_all(), OriginalFilename::optional_filename()) -> {ok, media_info()} | {error, term()}

Fetch information about a file, returns mime, width, height, type, etc.

is_mime_compressed/1

is_mime_compressed(X1::binary()) -> boolean()

Given a mime type, return whether its file contents is already compressed or not.

is_mime_vector/1

is_mime_vector(Mime::string() | mime_type()) -> boolean()


Generated by EDoc