Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4626542
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:26:09+00:00 2026-05-22T03:26:09+00:00

I have this function: http://pastebin.ca/2058418 It basically checks to see if a tables contains

  • 0

I have this function: http://pastebin.ca/2058418

It basically checks to see if a tables contains some URLs to pictures of a band. If it does, then it will order the table by random, choose the first result and then output the html code to insert the picture. If the table does not have the pictures of that specific band, then it downloads an XML file which contains the image URL’s, parses the XML and inserts in into the table, and then gets the HTML code for the image like before.

In terms out html output, you can’t tell if the image URL has been cached or not. HOWEVER, when the image URL is cached (for the first time), whatever web browser you use will not display the image. The HTML is fine – the image is linked correctly.

Do you have any ideas? A live version of the site which contains this function is here: http://redfern.me/similar/. I have just emptied the tables, so there shouldn’t be many cached URL’s. Try choosing a band, and then see if the image loads. You can tell if the URL’s where cached or not by looking at the bottom of the page.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:26:09+00:00Added an answer on May 22, 2026 at 3:26 am

    basically looks like you wasn’t returning after you fetched the image first time.

     <?php function getimage($artist){
            $api_key = "XXXXXXXXX";
            $iquery = mysql_query("SELECT url FROM `images` WHERE artist = '".$artist."' ORDER BY RAND() LIMIT 1");
            if($artist != ""){
                $artist = str_replace(" ", "+", $artist);
                if(mysql_num_rows($iquery) == 0){
                    $url = "http://developer.echonest.com/api/v4/artist/images?format=xml&api_key=".$api_key."&name=".$artist."&results=20";
                    $data = file_get_contents($url);
                    if($data=false){return 'Error Getting Image';}
    
                    $images = new SimpleXMLElement($data);
    
                    foreach($images as $image){
                        foreach($image->image as $indimage){
                            $insiquery = "INSERT INTO images (id, artist, url) VALUES (NULL, '$artist','".$indimage->url."')";
                            mysql_query($insiquery);
                        }
                    }
                    return "<img src=\"".$indimage->url."\" alt=\"$artist image\" />";
                }else{
                    $imgurl = mysql_fetch_array($iquery);
                    return"<img src=\"".$imgurl['url']."\" alt=\"$artist image\" />";
                }
    
            }
            else{
                return"Image Aquire Function Error: <i>No Band Specified</i>";
            }
            return null;
        }?>
    
    
    echo getimage('Britney Spears');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is the page, its a wordpress powered site: http://bit.ly/9oJXWV You select some value,
I'm trying to use this library : http://pastebin.com/xgPXpGtw (an example of use: http://pastebin.com/fNFAW3Fh )
I have this function to ensure every img tag has absolute URL: function absoluteSrc($html,
I've found this: function: http://github.com/timburks/NuMongoDB/blob/master/src/bson.c#L128 bytes: http://github.com/timburks/NuMongoDB/blob/master/src/platform_hacks.h#L55 struct: http://github.com/timburks/NuMongoDB/blob/master/src/bson.h#L70 But how exactly would I
I'm a total loss. I have this function to read the Twitter Json. The
I've written some javascript using jQuery to replace any select lists with a div
I've created a Greasemonkey script which replaces a page function: (function() { var oldFunc
I cannot seem to be able to figure out why I receive: Fatal error:
I am making a fraction class for a school project, and my brain is
It's weird! I was working on my CSS and jquery just stopped working! checked

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.