PHP Grab Remote Image 2

Cancelled Posted Jul 25, 2011 Paid on delivery
Cancelled Paid on delivery

I'm trying to grab an image from a yahoo site. I dont know the image type.

I can get the header type and then pass this content type to the fopen function it wont work. If I hard code the content type I can see the image.

Since I dont know the image type I need to grab it first then pass it to.

Once I get this going I need to save the image.

Heres my code

// open the file in a binary mode

$name= '[url removed, login to view]';

$headers = get_headers($name);

$image_type = '"Content-Type: image/'.substr($headers[7], 20, 4).'"';

$image_type2 = 'Content-Type: image/'.substr($headers[7], 20, 4) ;

//echo $image_type2 ;

// open the file in a binary mode

$fp = fopen($name, 'rb');

// send the right headers

header("Content-Type: image/gif");

//header(".$image_type2.");

header("Content-Length: " . filesize($name));

// dump the picture and stop the script

fpassthru($fp);

exit;

Engineering PHP Project Management Script Install Shell Script Software Architecture Software Testing Web Hosting Website Management Website Testing

Project ID: #3466602

About the project

2 proposals Remote project Active Jul 25, 2011

2 freelancers are bidding on average $13 for this job

mainegate

See private message.

$17 USD in 1 day
(17 Reviews)
3.6
icebreaking

See private message.

$8.5 USD in 1 day
(7 Reviews)
2.3