This is a basic code which I use to pull info from my affiliate product feed. I’m pulling, as you will see below, picture links…and store the urls into my databse. The problem is that I’m showing 20 products per page, and if the affiliate serves isn;’t working properly it slows donw my sites alot.
What i’d like to do is store the whole iamges somehow and hot the urls… I think that will improve my sites performance alot. Any ideeas?
$feed = 'my affiliate feed';
$xml = simplexml_load_file($feed);
foreach( $xml->productinfo as $productinfo )
{
$pic0 = $productinfo->picture[0];
$pic1 = $productinfo->picture[1];
$pic2 = $productinfo->picture[2];
mysql_query("INSERT INTO ".$table." (pic0, pic1, pic2) VALUES ('$pic0', '$pic1', '$pic2')");
}
Thank you
First change pic0, pic1 and pic2 fields to BLOB type. (You might also want to store the MIME type with getimagesize() for use with header() when delivering the images.)
I presume that you have an ID field in $table. Deliver images in a new PHP script like this: