PageRenderTime 59ms CodeModel.GetById 24ms app.highlight 26ms RepoModel.GetById 1ms app.codeStats 1ms

/doc/core/m_media.html

https://code.google.com/p/zotonic/
HTML | 154 lines | 129 code | 25 blank | 0 comment | 0 complexity | 1e47141b2d871f8c7a69b4d80edcae60 MD5 | raw file
  1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2<html>
  3<head>
  4<title>Module m_media</title>
  5<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
  6</head>
  7<body bgcolor="white">
  8<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
  9<hr>
 10
 11<h1>Module m_media</h1>
 12<ul class="index"><li><a href="#description">Description</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>Model for medium database.
 13<p>Copyright Š 2009 Marc Worrell
 14  Date: 2009-04-09
 15 </p>
 16
 17<p><b>Behaviours:</b> <a href="gen_model.html"><tt>gen_model</tt></a>.</p>
 18<p><b>Authors:</b> Marc Worrell (<a href="mailto:marc@worrell.nl"><tt>marc@worrell.nl</tt></a>).</p>
 19
 20<h2><a name="description">Description</a></h2>Model for medium database
 21<h2><a name="index">Function Index</a></h2>
 22<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#delete-2">delete/2</a></td><td>Delete the medium at the id.</td></tr>
 23<tr><td valign="top"><a href="#depiction-2">depiction/2</a></td><td>Get the medium record that depicts the resource id.</td></tr>
 24<tr><td valign="top"><a href="#depicts-2">depicts/2</a></td><td>Return the list of resources that is depicted by the medium (excluding the rsc itself).</td></tr>
 25<tr><td valign="top"><a href="#exists-2">exists/2</a></td><td>Check if a medium record exists.</td></tr>
 26<tr><td valign="top"><a href="#get-2">get/2</a></td><td>Get the medium record with the id.</td></tr>
 27<tr><td valign="top"><a href="#get_by_filename-2">get_by_filename/2</a></td><td>Fetch a medium by filename.</td></tr>
 28<tr><td valign="top"><a href="#identify-2">identify/2</a></td><td>Return the identification of a medium.</td></tr>
 29<tr><td valign="top"><a href="#insert_file-2">insert_file/2</a></td><td>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.</td></tr>
 30<tr><td valign="top"><a href="#insert_file-3">insert_file/3</a></td><td></td></tr>
 31<tr><td valign="top"><a href="#insert_url-2">insert_url/2</a></td><td>Make a new resource for the file based on a URL.</td></tr>
 32<tr><td valign="top"><a href="#insert_url-3">insert_url/3</a></td><td></td></tr>
 33<tr><td valign="top"><a href="#m_find_value-3">m_find_value/3</a></td><td>Fetch the value for the key from a model source.</td></tr>
 34<tr><td valign="top"><a href="#m_to_list-2">m_to_list/2</a></td><td>Transform a m_config value to a list, used for template loops.</td></tr>
 35<tr><td valign="top"><a href="#m_value-2">m_value/2</a></td><td>Transform a model value so that it can be formatted or piped through filters.</td></tr>
 36<tr><td valign="top"><a href="#replace-3">replace/3</a></td><td>Replace or insert a medium record for the page.</td></tr>
 37<tr><td valign="top"><a href="#replace_file-3">replace_file/3</a></td><td>Replaces a medium file, when the file is not in archive then a copy is made in the archive.</td></tr>
 38<tr><td valign="top"><a href="#replace_file-4">replace_file/4</a></td><td></td></tr>
 39<tr><td valign="top"><a href="#replace_file-5">replace_file/5</a></td><td></td></tr>
 40<tr><td valign="top"><a href="#replace_url-4">replace_url/4</a></td><td></td></tr>
 41<tr><td valign="top"><a href="#save_preview-4">save_preview/4</a></td><td>Save a preview for a medium record.</td></tr>
 42</table>
 43
 44<h2><a name="functions">Function Details</a></h2>
 45
 46<h3 class="function"><a name="delete-2">delete/2</a></h3>
 47<div class="spec">
 48<p><tt>delete(Id::RscId, Context) -&gt; ok | {error, Reason}</tt></p>
 49</div><p>Delete the medium at the id.  The file is queued for later deletion.</p>
 50
 51<h3 class="function"><a name="depiction-2">depiction/2</a></h3>
 52<div class="spec">
 53<p><tt>depiction(Id::RscId, Context) -&gt; PropList | undefined</tt></p>
 54</div><p>Get the medium record that depicts the resource id. "depiction" Predicates are preferred, when
 55  they are missing then the attached medium record itself is returned.  We must be able to generate a preview
 56  from the medium.</p>
 57
 58<h3 class="function"><a name="depicts-2">depicts/2</a></h3>
 59<div class="spec">
 60<p><tt>depicts(Id::RscId, Context) -&gt; [Id]</tt></p>
 61</div><p>Return the list of resources that is depicted by the medium (excluding the rsc itself)</p>
 62
 63<h3 class="function"><a name="exists-2">exists/2</a></h3>
 64<div class="spec">
 65<p><tt>exists(Name, Context) -&gt; any()</tt></p>
 66</div><p>Check if a medium record exists</p>
 67
 68<h3 class="function"><a name="get-2">get/2</a></h3>
 69<div class="spec">
 70<p><tt>get(Id::RscId, Context) -&gt; PropList</tt></p>
 71</div><p>Get the medium record with the id</p>
 72
 73<h3 class="function"><a name="get_by_filename-2">get_by_filename/2</a></h3>
 74<div class="spec">
 75<p><tt>get_by_filename(Filename, Context) -&gt; any()</tt></p>
 76</div><p>Fetch a medium by filename</p>
 77
 78<h3 class="function"><a name="identify-2">identify/2</a></h3>
 79<div class="spec">
 80<p><tt>identify(Id::ImageFilePath, Context) -&gt; {ok, PropList} | {error, Reason}</tt></p>
 81</div><p>Return the identification of a medium. Used by z_media_identify:identify()</p>
 82
 83<h3 class="function"><a name="insert_file-2">insert_file/2</a></h3>
 84<div class="spec">
 85<p><tt>insert_file(File, Context) -&gt; {ok, Id} | {error, Reason}</tt></p>
 86</div><p>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</p>
 87
 88<h3 class="function"><a name="insert_file-3">insert_file/3</a></h3>
 89<div class="spec">
 90<p><tt>insert_file(Upload, Props, Context) -&gt; any()</tt></p>
 91</div>
 92
 93<h3 class="function"><a name="insert_url-2">insert_url/2</a></h3>
 94<div class="spec">
 95<p><tt>insert_url(Url::File, Context) -&gt; {ok, Id} | {error, Reason}</tt></p>
 96</div><p>Make a new resource for the file based on a URL.</p>
 97
 98<h3 class="function"><a name="insert_url-3">insert_url/3</a></h3>
 99<div class="spec">
100<p><tt>insert_url(Url, Props, Context) -&gt; any()</tt></p>
101</div>
102
103<h3 class="function"><a name="m_find_value-3">m_find_value/3</a></h3>
104<div class="spec">
105<p><tt>m_find_value(Id::Key, M::Source, Context) -&gt; term()</tt></p>
106</div><p>Fetch the value for the key from a model source</p>
107
108<h3 class="function"><a name="m_to_list-2">m_to_list/2</a></h3>
109<div class="spec">
110<p><tt>m_to_list(M::Source, Context) -&gt; List</tt></p>
111</div><p>Transform a m_config value to a list, used for template loops</p>
112
113<h3 class="function"><a name="m_value-2">m_value/2</a></h3>
114<div class="spec">
115<p><tt>m_value(M::Source, Context) -&gt; term()</tt></p>
116</div><p>Transform a model value so that it can be formatted or piped through filters</p>
117
118<h3 class="function"><a name="replace-3">replace/3</a></h3>
119<div class="spec">
120<p><tt>replace(Id, Props, Context) -&gt; ok | {error, Reason}</tt></p>
121</div><p>Replace or insert a medium record for the page.  This is useful for non-file related media.
122  Resets all non mentioned attributes.</p>
123
124<h3 class="function"><a name="replace_file-3">replace_file/3</a></h3>
125<div class="spec">
126<p><tt>replace_file(File, RscId, Context) -&gt; {ok, Id} | {error, Reason}</tt></p>
127</div><p>Replaces a medium file, when the file is not in archive then a copy is made in the archive.
128  When the resource is in the media category, then the category is adapted depending on the mime type of the uploaded file.</p>
129
130<h3 class="function"><a name="replace_file-4">replace_file/4</a></h3>
131<div class="spec">
132<p><tt>replace_file(File, RscId, Props, Context) -&gt; any()</tt></p>
133</div>
134
135<h3 class="function"><a name="replace_file-5">replace_file/5</a></h3>
136<div class="spec">
137<p><tt>replace_file(File, RscId, Props, PropsMedia, Context) -&gt; any()</tt></p>
138</div>
139
140<h3 class="function"><a name="replace_url-4">replace_url/4</a></h3>
141<div class="spec">
142<p><tt>replace_url(Url, RscId, Props, Context) -&gt; any()</tt></p>
143</div>
144
145<h3 class="function"><a name="save_preview-4">save_preview/4</a></h3>
146<div class="spec">
147<p><tt>save_preview(RscId, Data, Mime, Context) -&gt; any()</tt></p>
148</div><p>Save a preview for a medium record. The data is saved to a file in the archive directory.</p>
149<hr>
150
151<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
152<p><i>Generated by EDoc, Aug 12 2011, 20:01:40.</i></p>
153</body>
154</html>