I am retrieving some images post with:
$img = wp_get_attachment_image_src( $attachment_id, 'full' );
How can I retrieve the image title?
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
In WordPress attachments are stored as posts so you can use most of the post specific WordPress calls and functions to read/write data associated with the attachment. This applies to post meta data for an attachment as well.
So in this case, since you have the post ID ( same as $attachment_id ) you can simply use the
$sImageTitle = get_the_title( $attachment_id );
This returns a string of the post's title for the given post ID.
See more info. at the codex docs here.