Search code examples
phpimagekohanakohana-3

set value's in img tag in php


I am trying to assign the dynamic path of the image using php.

While trying to echo the path using

echo '<img src="'.$guild_image_path.'"/>';

I am getting the correct path.

But if i apply the same in my application i am not getting the image path.

Please refer my code below,

printf( '<span class="byline"><span class="rounded_image"><a  href="%4$s" rel="author"><?php echo '<img src="'.$guild_image_path.'"/>'; ?>%5$s</a></span></span>',  
                esc_url( get_permalink() ),
        esc_attr( get_the_date( 'c' ) ),
        esc_html( get_the_date() ),
        esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
        get_the_author()
    );

Please help me to do this.


Solution

  • try debug using error_log or echo before printf() to make sure you are getting the value in the variable $guild_image_path.

    error_log('image path'.$guild_image_path);
    

    or

    echo $guild_image_path;