img src=”Array” ?

This topic is: not resolved

This topic contains 9 replies, has 4 voices, and was last updated by  hsatterwhite 2 years, 2 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #165292

    databell
    Participant
    Post count: 1

    I’m trying to display an image I setup in my pod as a File Upload.In my code, I use:

    But that doesn’t seem to work well. I don’t get the image in my template and the code says img src="Array" instead of the actual name of the image. Don’t understand why since I’ve used this previously on other sites without an issue. Any clue where I went wrong?

    #165293

    benfavre
    Participant

    <img src="<?php echo $artists_videoimg[0]; ?>" alt="Image" title="Image" />

    #165294

    databell
    Participant
    Post count: 1

    That didn’t work. I’m still not receiving an image.

    #165295

    databell
    Participant
    Post count: 1

    Now I’m getting instead:

    #165296

    Kamil Grzegorczyk (Owi)
    Participant
    Post count: 14

    You can always make

    To see the contents of Your array and check at what index url is kept.

    But in my opinion code should be like

    #165297

    databell
    Participant
    Post count: 1

    Well, I tried the print approach owi suggested but all I got was:
    <p>Array</p>
    Which isn’t what I wanted and now makes me wonder if the file uploaded at all. Problem is I currently can’t access the database because web.com changed the password on my clients’ control panel so currently I can’t login. Obviously, I’ll have to get back to you on this issue once I can access the DB.

    #165298

    databell
    Participant
    Post count: 1

    OK, I have an update. Seems that even though I defined a variable called video_img in my pod, it’s not showing as a field for that same pod in the database.It does show up in the wp_pod_fields table so this is kind of unexplainable. Why would that be happening? Only reason I can think of is because there’s an underscore in it.

    #165299

    benfavre
    Participant

    <?php
    $artists_videoimg = $Pod->get_field(‘imgfieldname.guid’);
    ?>
    Your image url is : <?php print_r($artists_videoimg); ?><br />

    <img src="<?php echo $artists_videoimg[0]; ?>" alt="Image" title="Image" />

    It doesn’t appear in the db table because it’s a related field. And uses the same schema as any media element in WP.
    Nothing is wrong check your php code.

    #165300

    databell
    Participant
    Post count: 1

    It’s not a related field. At least it shouldn’t be. It’s just a field as part of the overall pod. I have another File Upload field and the data shows up from that. So this makes no sense. The rest of my PHP is good. This is the only issue. All other data from this pod appears. If I use gr0b1′s code from the previous post, it just stops my HTML in its’ tracks.

    I posted the PHP code on PasteBin for the entire page. So maybe there’s a clue there:

    http://pastebin.com/4UQnAttJ

    #165301

    hsatterwhite
    Member

    You need to use the machine name as defined the for the file upload column in your Pod. Owi had it right with his posted code.

    I looked at your paste bin and it seems like instead of using video_img as you referenced previously you’re using videoimg in your get_field call.

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

You must be logged in to reply to this topic.

Wordpress Cloud Hosting