Bug #13960: ImageCreateFromJPEG doesn't work with URLs

From: Date: Tue, 06 Nov 2001 19:36:42 +0000
Subject: Bug #13960: ImageCreateFromJPEG doesn't work with URLs
Groups: php.dev 
Request: Send a blank email to php-dev+get-69716@lists.php.net to get a copy of this message
From:             S.G.Spencer@warwick.ac.uk
Operating system: Windows XP
PHP version:      4.0.6
PHP Bug Type:     *Graphics related
Bug description:  ImageCreateFromJPEG doesn't work with URLs

The following code should give me the image served by my webcam server:

$cam = ImageCreateFromJPEG('http://localhost:69/');
imagejpeg($cam);

But instead gives me:

Warning: imagecreatefromjpeg: Unable to open 'http://localhost:69/' for
reading in c:\program files\apache\htdocs\webcam\cam.php
If, however, I create a local copy of the output of the server, like
this:

$in = fopen('http://localhost:69/','rb');
$out = fopen('tempcam.jpg','wb');
while ( !feof($in) ) {
 $temp = fread ($in, 4096);
 fwrite($out,$temp);
}
fclose ($in); fclose($out);

and then use ImageCreateFromJPEG on that file instead of the URL, it works
perfectly.

Therefore, ImageCreateFromJPEG doesn't re-use the fopen code correctly (as
it should and is hinted to by the manual page saying that
ImageCreateFromJPEG can open files or URLs).

Bug 6825 seems to be similar, but for PHP 4.0.2. The bug was closed as it
was allegedly fixed, but now seems to have re-surfaced.
-- 
Edit bug report at: http://bugs.php.net/?id=13960&edit=1



Thread (5 messages)

« previous php.dev (#69716) next »