What's wrong with this code?
<?php
$off_site = 'http://site.co.nz/images/logo.jpg';
$fp = fopen ($off_site, 'rb') or die('Unable to open file '.$off_site.' for reading');
$buf = '';
while (!feof ($fp))
{
$buf .= fgets($fp, 4096);
}
header('Content-Type: image/jpeg');
$data = $buf;
$size = 150;
$src = imagecreatefromstring ($data);
$width = imagesx($src);
$height = imagesy($src);
$aspect_ratio = $height/$width;
if ($height <= $size)
{
$new_w = $width;
$new_h = $height;
} else {
$new_h = $size;
$new_w = abs($new_h / $aspect_ratio);
}
$img = imagecreatetruecolor ($new_w,$new_h);
imagecopyresampled ($img,$src,0,0,0,0,$new_w,$new_h,$width,$height);
imagejpeg($img, '', 90);
imagedestroy($img);
?>
I get this error:
Warning: fopen(http://site.co.nz/images/logo.jpg): failed to open stream: No route to host in /home3/kiwis/public_html/pics.php on line 3
Unable to open file http://site.co.nz/images/logo.jpg for reading