Results 1 to 2 of 2

Thread: only display specific image from foreach()

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2009
    Posts
    876

    only display specific image from foreach()

    PHP Code:
    foreach($get->artist->image as $image) {
    $image = (array) $image;
        echo 
    'İmage Text = '.$image['#text'].'<br />
            İmage Size = '
    .$image['size'].'<br />';

    Displays
    Code:
    İmage Text = http://userserve-ak.last.fm/serve/34/210303.jpg
    İmage Size = small
    İmage Text = http://userserve-ak.last.fm/serve/64/210303.jpg
    İmage Size = medium
    İmage Text = http://userserve-ak.last.fm/serve/126/210303.jpg
    İmage Size = large
    İmage Text = http://userserve-ak.last.fm/serve/252/210303.jpg
    İmage Size = extralarge
    İmage Text = http://userserve-ak.last.fm/serve/500/210303/Coldplay.jpg
    İmage Size = mega


    I only want it to display the extra large image ( İmage Text = http://userserve-ak.last.fm/serve/252/210303.jpg
    İmage Size = extralarge)

    How would I do this?

    Jamie

  2. #2
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: only display specific image from foreach()

    PHP Code:
    foreach($get->artist->image as $image) { 
         
    $image = (array) $image
         if (
    $image['size'] == "extralarge") {
              echo 
    'İmage Text = '.$image['#text'].'<br /> 
              İmage Size = '
    .$image['size'].'<br />'
         }


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width