How to get comment images stored as serialized comment meta

I want to display images under for each comment but images store in database as serialized a:3:{i:0;i:775;i:1;i:776;i:2;i:777;} I wrote this code

 print_r (get_comment_meta( $comment-comment_ID , 'reviews-images', true ));

but it outputs this *

Array ( [0] = 778 [1] = 779 [2] = 780 [3] = 781 [4] = 782 ) 10

then I tried this

echo get_comment_meta( $comment-comment_ID, 'reviews-images', true );

not worked . Please help how can I get image urls instead of this output

Topic meta-value attachments comments query Wordpress

Category Web


What you get is fine, it's the image id, now you just need to loop them and output the structure that you want, for example.

if (!empty($images = get_comment_meta( $comment->comment_ID , 'reviews-images', true ))) {
    foreach ($images as $image_id) {
        $image_src = wp_get_attachment_image_src($image_id, 'full');

        // Now you have the image src, $image_src, you can do what ever you want here
    }
}

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.