Copyright © 2009-2014 Marc Worrell
Behaviours: gen_model.
Authors: Marc Worrell (marc@worrell.nl).
delete/2 | Delete the medium at the id. |
depiction/2 | Get the medium record that depicts the resource id. |
depicts/2 | Return the list of resources that is depicted by the medium (excluding the rsc itself). |
download_file/1 | Download a file from a http or data url. |
download_file/2 | |
duplicate/3 | Duplicate the media item from the id to the new-id. |
exists/2 | Check if a medium record exists. |
get/2 | Get the medium record with the id. |
get_by_filename/2 | Fetch a medium by filename. |
get_file_data/2 | Return the contents of the file belonging to the media resource. |
identify/2 | Return the identification of a medium. |
insert_file/2 | Make a new resource for the file, when the file is not in the archive dir then a copy is made in the archive dir. |
insert_file/3 | |
insert_file/4 | |
insert_medium/4 | Insert a medium, together with rsc props and an optional preview_url. |
insert_url/2 | Make a new resource for the file based on a URL. |
insert_url/3 | |
insert_url/4 | |
is_unique_file/2 | |
m_find_value/3 | Fetch the value for the key from a model source. |
m_to_list/2 | Transform a m_config value to a list, used for template loops. |
m_value/2 | Transform a model value so that it can be formatted or piped through filters. |
make_preview_unique/3 | |
merge/3 | Move a medium between resources, iff the destination doesn't have an associated medium. |
mime_to_category/1 | |
replace/3 | Replace or insert a medium record for the page. |
replace_file/3 | Replaces a medium file, when the file is not in archive then a copy is made in the archive. |
replace_file/4 | |
replace_file/5 | |
replace_file/6 | |
replace_medium/5 | |
replace_url/4 | |
replace_url/5 | |
save_preview/4 | Save a preview for a medium record. |
save_preview_url/3 | Save a new file from a preview_url as the preview of a medium. |
delete(Id::RscId, Context) -> ok | {error, Reason}
Delete the medium at the id. The file is queued for later deletion.
depiction(Id::RscId, Context) -> PropList | undefined
Get the medium record that depicts the resource id. "depiction" Predicates are preferred, when they are missing then the attached medium record itself is returned. We must be able to generate a preview from the medium.
depicts(Id::RscId, Context) -> [Id]
Return the list of resources that is depicted by the medium (excluding the rsc itself)
download_file(Url) -> any()
Download a file from a http or data url.
download_file(Url, Options) -> any()
duplicate(FromId::m_rsc:resource(), ToId::m_rsc:resource(), Context::#context{}) -> ok
Duplicate the media item from the id to the new-id. Called by m_rsc:duplicate/3
exists(Name, Context) -> any()
Check if a medium record exists
get(Id::RscId, Context) -> PropList
Get the medium record with the id
get_by_filename(Filename, Context) -> any()
Fetch a medium by filename
get_file_data(Id, Context) -> any()
Return the contents of the file belonging to the media resource
identify(Id::ImageFilePath, Context) -> {ok, PropList} | {error, Reason}
Return the identification of a medium. Used by z_media_identify:identify()
insert_file(File, Context) -> {ok, Id} | {error, Reason}
Make a new resource for the file, when the file is not in the archive dir then a copy is made in the archive dir
insert_file(Upload, Props, Context) -> any()
insert_file(Upload, Props, Options, Context) -> any()
insert_medium(Medium, RscProps, Options, Context) -> any()
Insert a medium, together with rsc props and an optional preview_url. This is used for importing media
insert_url(Url::File, Context) -> {ok, Id} | {error, Reason}
Make a new resource for the file based on a URL.
insert_url(Url, Props, Context) -> any()
insert_url(Url, Props, Options, Context) -> any()
is_unique_file(Filename, Context) -> any()
m_find_value(Id::Key, M::Source, Context) -> term()
Fetch the value for the key from a model source
m_to_list(M::Source, Context) -> List
Transform a m_config value to a list, used for template loops
m_value(M::Source, Context) -> term()
Transform a model value so that it can be formatted or piped through filters
make_preview_unique(RscId::integer() | insert_rsc, Extension::string(), Context::#context{}) -> file:filename()
merge(WinnerId, LooserId, Context) -> any()
Move a medium between resources, iff the destination doesn't have an associated medium. This is called when merging two resources (and the FromId is subsequently deleted).
mime_to_category(Mime) -> any()
replace(Id, Props, Context) -> ok | {error, Reason}
Replace or insert a medium record for the page. This is useful for non-file related media. Resets all non mentioned attributes.
replace_file(File, RscId, Context) -> {ok, Id} | {error, Reason}
Replaces a medium file, when the file is not in archive then a copy is made in the archive. When the resource is in the media category, then the category is adapted depending on the mime type of the uploaded file.
replace_file(File, RscId, Props, Context) -> any()
replace_file(File, RscId, Props, Opts, Context) -> any()
replace_file(Upload, RscId, Props, MInfo, Opts, Context) -> any()
replace_medium(Medium, RscId, RscProps, Options, Context) -> any()
replace_url(Url, RscId, Props, Context) -> any()
replace_url(Url, RscId, Props, Options, Context) -> any()
save_preview(RscId, Data, Mime, Context) -> any()
Save a preview for a medium record. The data is saved to a file in the archive directory.
save_preview_url(RscId, Url, Context) -> any()
Save a new file from a preview_url as the preview of a medium
Generated by EDoc, Apr 20 2018, 18:07:53.