Posted by sberry on 08/28/07 15:09
I have an image proxy script I use to retrieve images from a remote
server and store locally on the first request. On the second request
(and all requests after) the image is returned from the local machine.
This has been working fine, but now I am using images that are 4+ MB
in size and the script is only saving a small portion of the image
rather than the entire thing.
Is there a limit to the size of the Image object?
------------- script snippet below -------------
if (! is_file($this->localDir . "/" . $image)) {
$image_remote = @imagecreatefromjpeg($this->remoteUrl . "/" .
$image);
$image_dir = dirname($this->localDir . "/" . $image);
$this->createWritableDirectory($image_dir);
imagejpeg($image_remote, $this->localDir . "/" . $image, $this-
>jpeg_quality);
header("Content-type: image/jpg");
header("Content-Length: ". filesize($this->localDir . "/" . $image));
imagejpeg($image_remote);
ob_end_flush();
return;
} else {
header("Content-type: image/jpg");
header("Content-Length: ". filesize($this->localDir . "/" . $image));
readfile($this->localDir . "/" . $image);
ob_end_flush();
return;
}
Navigation:
[Reply to this message]
|