Reply to Re: Downloading image from URL not saving entire image?

Your name:

Reply:


Posted by Jerry Stuckle on 08/28/07 16:22

sberry wrote:
> 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;
> }
>

How much memory have you given PHP? The default (8M) probably isn't
enough for a 4M jpeg.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация