Running PHP Version 4.3.6, GD Version 2.0.22 on SunOS ray 5.9 Generic_112233-11 sun4u. (full php info at http://www.tamariskfarm.com/construction/info.php)
test code:
- Code: Select all
<?php
$filename = 'test.jpg';
//Doesn't work
//test.jpg is in the same directory as the php file and both the directory and the files have permissions set to 0777
//$filename = 'http://www.tamariskfarm.com/construction/resize/test.jpg';
//Doesn't work when run from local host. When I take this php file and run from another server it works fine with this path.
//$filename = 'http://us.i1.yimg.com/us.yimg.com/i/buzz/2005/09/0924cowboycheerleaderssmall.jpg';
//Works fine taking the image from a yahoo server, or any other server I have tried.
if ($image = @imagecreatefromjpeg($filename))
{
header("HTTP/1.1 202 Accepted");
header('Content-type: image/jpeg');
imagejpeg($image, '', 100);
imagedestroy($image);
}
else
{
echo '<h1>ERROR</h1>';
echo 'filename : '.$filename.'<br>';
echo 'fileowner : ' . fileowner($filename) . '<br>';
echo 'fileperms : ' . substr(sprintf('%o', fileperms($filename)), -4) . '<br>';
echo 'is_readable: ' . is_readable($filename) . '<br>';
echo '<img src="'.$filename.'" alt="Image failed to load"><br>';
}
?>
I wrote a php file that outputted the requested image file. When this was running on an external server it worked fine but when on the local server didn't work with GD (it showed the image perfectly when accessed directly).
An ideas? This has really confused me...
Samuel Simon



