Forum Moderators: coopster

Message Too Old, No Replies

Getting Amazon images remotely...slow

getimagesize, fopen takes forever!

         

ianevans

2:49 pm on Jul 16, 2004 (gmt 0)

10+ Year Member



I'm working on a script to load my database up with some product info from Amazon's AWS.

As you may know, the AWS does not return dimensions with the image url.

I tried using getimagesize on the remote URL, it would literally take over a minute per image.

I used a script at from O'Reilly's hackbook (#477) to cache the .jpg locally and then getimagesize it. Here it is:

$asin = "0788815709";
$url = [images.amazon.com...]
$filedata = "";
$remoteimage = fopen($url, 'rb');
if ($remoteimage) {
while(!feof($remoteimage)) {
$filedata.= fread($remoteimage,1024);
}
}
fclose($remoteimage);
$localimage = fopen("/tmp/".$asin.".jpg", 'wb');
fwrite($localimage,$filedata);
fclose($localimage);
$size=getimagesize($localimage);

Again, it would take FOREVER.

Even tried Pear's remote_image. FOREVER!

I'm able to get all the XML info for hundreds of DVDs in seconds...any clue why it's taking forever to deal with the images?

httpwebwitch

8:44 pm on Jul 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I repeated your experiment using your code, and got the image size really fast, every time. It must be something peculiar to some servers and not others. There was someone else complaining about the same problem just a few weeks ago.

Sorry I can't help :(

ianevans

12:34 am on Jul 17, 2004 (gmt 0)

10+ Year Member



Here are my timing results:

Did local getimagesize in 0.00020003318786621 seconds
Did getimagesize(remotefile) in 150.61647987366 seconds

Ouch...

yowza

2:27 am on Jul 17, 2004 (gmt 0)

10+ Year Member



That was me complaining a couple of weeks ago.

I'm using a host that is very popular with webmasters, and most likely is more popular with webmaster world members.

getimagesize() sometimes takes over a minute per image for me.

I've already complained so many times to the host that I am tired of it.