Display image tags?

Hey guys,

I’m trying to display the tags that have been added to an image. I find it easy enough to display the alternate text and imageURL but I can’t seem to echo out the image tags. I can’t even see the tag property within the image object. Thanks for the help. :slight_smile:



$ad_image = nggdb::find_image($image_id);

if($ad_image) :
            $external_link = nggcf_get_field($ad_image->pid, 'External Link');
            ?>
        <a href="<?php echo isset($external_link) ? $external_link : '#'; ?>">
            <img src="<?php echo $ad_image->imageURL; ?>" alt="<?php echo $ad_image->alttext; ?>">
        </a>

        <?php $posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
echo $tag->name . ' ';
}
}

Hi ConTici,

The following code should do what you want.

HTH

<?php $tags = wp_get_object_terms($image->pid,'ngg_tag') ?>

<?php foreach ( $tags as $tag ) : ?>
  <?php echo $tag->name; ?>
<?php endforeach; ?>

Thanks Pullo, I’ll give it a try. :slight_smile: