You could use a template for your cck field, in your case the name of this file could be field--field-bg-image.tpl.php
and should be put inside your current theme folder, then you could add your id
attribute like this:
// in field--field-bg-image.tpl.php
<div id="your-id" class="<?php echo $classes; ?>">
<?php print render($items); ?>
</div>
Have a look at field.tpl.php
If you wan't to set the id
on the actual img
tag you could do something along these lines in your field--field-bg-image.tpl.php
file:
$object = $element['#object'];
$data = $object->field_bg_image[$object->language][0];
$fid = $data['fid'];
$width = $data['width'];
$height = $data['height'];
print '<img id="your-id" src="'.file_create_url(file_load($fid)->uri).'" width="'.$width.'" height="'.$height.'" />';
You may also checkout theme_image() and do like this:
print theme_image(
array('path'=>file_load($fid)->uri,
'attributes'=>
array('alt'=>'','id'=>'your-id')
)
);