Here is how to get a Drupal 6 CCK Filefield Imagefield default image path:
function tf_cck_nodefield_widget_settings ($field_name) {
$sql = " SELECT widget_settings FROM {content_node_field_instance} WHERE field_name = '%s' ";
return unserialize(db_result(db_query($sql,$field_name)));
}
// example usage
$my_imagefield_widget_settings = tf_cck_nodefield_widget_settings("field_my_image");
$img_src = $my_imagefield_widget_settings['default_image']['filepath'];
print theme_image($img_src,"","");
This will also work for many other CCK field widget settings, as the function above just returns an array of the unserialized string that represents the widget settings.
Add new comment