Add title and alternate text to image automatically? In my site users can upload content and also images.

My goal is that when a user is uploading content to the site, and also an image - the title of the content will be also the image title and the alternate text of the image.
Currently I am using the core image field.

Is there a way or a module that can achieve all that?
The most direct way might be to do something along these lines in hook_node_presave() in a custom module:

function YOURMODULE_node_presave($node) {

  if(isset($node-&gt;field_image)) {
    $node-&gt;field_image[LANGUAGE_NONE][0]['alt']=$node-&gt;title;
    $node-&gt;field_image[LANGUAGE_NONE][0]['title']=$node-&gt;title;
  }

}


where field_image is the actual name of the image field you have in your node.

If you don't want your users to be see or to attempt to change this, just make sure the alt and title boxes aren't checked in the field setup, eg:



as this is just for the field add/edit widget in the form; the above code will still work even if these attributes aren't "enabled."