Support

Account

Home Forums General Issues Wrong output for image

Solved

Wrong output for image

  • I have two different Advanced custom fields in the same page, one is working fine, however the other when comes out weird.

    The custom field loads:

    <img src="383, , _MG_9152, , UT, http://media5.utt.se/2013/06/MG_9152webb-e1370957481647.jpg, 680, 291, Array">
    

    and not:
    <img src="http://media5.utt.se/2013/06/MG_9152webb-e1370957481647.jpg">

    <?php global $post;
      $id = '4'; //set the post id here
      $post = get_post($id); //get the post
      setup_postdata($post); //setup the post
    ?>
    <div class="splash">
    	<img src="<?php the_field('splash'); ?>"/>
    </div>

    Any clue where the problem lies?

  • you have the image field set to return the image object rather than just the URL..

    go into your field group and change the field to return just the URL, then replace the_field(‘splash’); with echo get_field(‘splash’);

  • Thanks, I can’t believe I missed this 🙂
    Actually it worked by just changing the settings!
    Cheers

  • Great 🙂

    Aye I suppose it works with the_field as well.. it’s just the paranoid coder inside me that doesn’t like it when something echoes things out for me =P

  • Ah, one day I hope to be as paranoid as you 🙂

  • Well I’m only 23 so it might not take so long if you keep it up! 😉

  • Well I’d say it is more a matter of how deep one is into The Code, than age (I’m 26) ^_^

  • One day you’ll see sourcecode of The Matrix!

    in all seriousness I meant it more in a way that I haven’t been at it for that long, so it doesn’t have to take 15 years in the business to develop it ^_^

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Wrong output for image’ is closed to new replies.