PHP midgard object method find_attachments
Find object's attachments.
array find_attachments(array args);
This method takes one argument:
- args, associative array
Array's keys must be midgard_attachment properties' names, values should define constraints with properties's values.
Lists object's attachments and store them in returned array.
Returns array with midgard_attachment objects, or empty array if there are no parameters for object.
Example
<?php
/* Find all image attachments */
try {
$style = new midgard_style($guid);
} catch (Exception $e) {
echo $e->getMessage();
}
$args = array ("mimetype" => "image/jpeg");
$atts = $style->find_atachments($args);
if(!empty($atts)) {
foreach($atts as $obj) {
echo $obj->name;
}
} else {
echo "Didn't find any object's attachments";
}
?>
