/[drupal]/contributions/modules/imagecache_actions/help/textrender_syntax.html
ViewVC logotype

Diff of /contributions/modules/imagecache_actions/help/textrender_syntax.html

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.1, Mon Aug 31 04:13:26 2009 UTC revision 1.1.2.2, Fri Oct 30 13:52:31 2009 UTC
# Line 5  Line 5 
5          enter PHP code that will <b>return</b> your dynamic text. Do not use &lt;?php  ?&gt; tags.          enter PHP code that will <b>return</b> your dynamic text. Do not use &lt;?php  ?&gt; tags.
6          <br />EG          <br />EG
7          <br /><code>return format_date(time());</code>          <br /><code>return format_date(time());</code>
8          <br /><code>return $file_data->description ? $file_data->description : $node->title;</code>          <br /><code>return $file_data->description ? $file_data->description : $node->teaser;</code>
9        </p>        </p>
10        <p>Note that executing incorrect PHP-code can break your Drupal site.</p>        <p>Note that executing incorrect PHP-code can break your Drupal site.</p>
11    
12        <h4>Many different types of data derived from the image may be available as php values:</h4>        <h4>Available data objects</h4>
13        <p>$node, $file_data, $image</p>        <p>Many different types of data derived from the image <em>may</em> be available as php values:</p>
14        <p>        <dl>
15          If it's an <b>image.module image</b> then a <b>$node</b> object with its values        <dt><code>$node</code></dt>
16          <em>may</em> be available.        <dd>A handle on the owning node object, if any.
17          <br/><code>return $node->title;</code>          <br/><code>return $node->title;</code>
18          <br/><code>return format_date($node->created);</code>          <br/><code>return format_date($node->created);</code>
19          </dd>
20          <dt><code>$image</code></dt>
21          <dd>A handle on the internal imageeapi technical image object.
22            <br/><code>return $image->source;</code>
23            <br/><code>return basename($image->source);</code>
24            <br/><code>return $image->info["filesize"];</code>
25          </dd>
26          <dt><code>$file_metadata</code></dt>
27          <dd>A collection of metadata that <em>may</em> have been deduced from other sources or context. Values inside <code>$file_data</code> is namespaced, structured and attributed, so can be complex to read.
28            <br/><code>drupal_set_message('&lt;pre>'. print_r($file_metadata,1). '&lt;/pre>'); return "";</code>
29          </dd>
30          <dt><code>$file_data</code></dt>
31          <dd>A simplified list of metadata values that <em>may</em> have been deduced from other sources. This is a flattened, simplified version of <code>$file_data</code> with no namespaces and all-lowercase attribute names.
32            <small><code>$file_metadata->Iptc4xmpCore:Scene['pjmt:0'] = "exterior view";</code> becomes <code>$file_data->scene = "exterior view"</code></small>
33            <br/><code>return $file_attributes->description</code>
34            <br/><code>return $file_attributes->copyright</code>
35          </dd>
36    
37          <h4>Where the data comes from</h4>
38          <p>
39            If it's an <b>image.module image</b> then a <b><code>$node</code></b> object with its values
40            <em>may</em> be available.
41        </p>        </p>
42    
43        <p>        <p>
44          If it's an image that has been attached to a node using <b>CCK filefield imagefield</b>          If it's an image that has been attached to a node using <b>CCK filefield imagefield</b>
45          (or just filefield)          (or just filefield)
46          then as well as the parent <b>$node</b> object,          then as well as the parent <b><code>$node</code></b> object,
47          a <b>$file_data</b> object that may contain a file description from that file field.          the <b><code>$file_data</code></b> object that may contain a file description
48            (or other meta supplied by cck) from that file field.
49          <br/><code>return $file_data->description;</code>          <br/><code>return $file_data->description;</code>
50          <br/>          <br/>
51          <small>So far that seems to be the only available 'data' provided by filefield,          <small>So far that seems to be the only available 'data' provided by filefield,
# Line 31  Line 54 
54        </p>        </p>
55        <p>        <p>
56          If it's a file that's just been <b>attached using upload.module</b>,          If it's a file that's just been <b>attached using upload.module</b>,
57          a <b>$file_data</b> object may also have a description.          a <b><code>$file_data</code></b> object may also have a description.
58          <br/><code>return $file_data->description;</code>          <br/><code>return $file_data->description;</code>
59        </p>        </p>
60        <p>        <p>
# Line 40  Line 63 
63        </p>        </p>
64    
65        <p>        <p>
66          An "<b>$image</b>" object is also available, but that usually contains only technical data, including          If you have <b>meta_inspector</b> available, then many more (namespaced)
67          <br/><code>return $image->source;</code>          metadata fields may be available on the <b><code>$file_metadata</code></b>
68          <br/><code>return basename($image->source);</code>          and <b><code>$file_data</code></b> object.
69          <br/><code>return $image->info["filesize"];</code>          Note that they will often be structured arrays.
70        </p>          <br /><code>$attname = "dc:creator"; return @reset($file_metadata->$attname);</code>
71        <p>          <br /><small>See the documentation for the meta suite and <code>HOOK_metadata_from_file()</code>
72          If you have <b>meta_inspector</b> available, then many more (namespaced) metadata fields          for more about this data structure.</small>.
         may be available on the <b>$file_data</b> object. Note that they will often be arrays.  
         <br /><code>$attname = "dc:creator"; return @reset($file_data->$attname);</code>  
73        </p>        </p>
74  </body>  </body>
75  </html>  </html>

Legend:
Removed from v.1.1.2.1  
changed lines
  Added in v.1.1.2.2

  ViewVC Help
Powered by ViewVC 1.1.2