php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18609 ImageCreateFromJPEG can't fetch from a URL
Submitted: 2002-07-27 12:35 UTC Modified: 2004-05-27 08:33 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: midg3t at mail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.0-dev OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: midg3t at mail dot com
New email:
PHP Version: OS:

 

 [2002-07-27 12:35 UTC] midg3t at mail dot com
This bug has been posted once before, but the discussion was closed due to inactivity.

Using GD "1.6.2 or higher" or GD 2 (the versions with PHP 4.2.2), ImageCreateFromJPEG() produces an error when trying to fetch an image from a URL. It works fine for grabbing local files. I am using the PHP SAPI module for Apache 1.3.26.

To generate the error, just use the function

imagecreatefromjpeg("http://www.somesite.com/image.jpg");

It returns the following error:

Warning: imagecreatefromjpeg: Unable to open 'http://www.someserver.com/image.jpg' for reading in c:\folder\file.php on line 53

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-27 12:36 UTC] sniper@php.net
Try this snapshot:

http://snaps.php.net/win32/php4-win32-latest.zip
 [2002-07-27 12:37 UTC] midg3t at mail dot com
Just a note that I should have made the two example URLs the same - they were before I edited them.
 [2002-07-27 12:46 UTC] sniper@php.net
Try the snapshot..

 [2002-07-27 12:51 UTC] midg3t at mail dot com
The error still occurs.

Version info:
PHP Version 4.3.0-dev
API Versions:
  PHP: 20020307
  PHP Extension: 20020429
  Zend Extension: 20020429
 [2002-07-27 12:54 UTC] midg3t at mail dot com
Using the bundled version of GD2 the error message changed to...

Warning: imagecreatefromjpeg("http://www.someserver.net/php/images/fakeid/main.jpg") - Invalid argument in c:\dir\fakeid.php on line 53
 [2002-08-28 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2002-08-28 12:24 UTC] sniper@php.net
feedback was given..happens also with 4.3.0-dev.

 [2002-08-28 12:25 UTC] sniper@php.net
Please add the shortest possible example script
into this report which can be used to reproduce this.
(and set the status back to 'Open' when you do this..)

 [2002-08-29 04:19 UTC] midg3t at mail dot com
<?php
imagecreatefromjpeg("http://midg3t.homeip.net/images/psu-engrish.jpg");
?>
 [2002-08-29 12:14 UTC] iliaa@php.net
Attempt to open a remote image via imagecreatefromjpeg() results in a 'failed to create stream: invalid argument' error.
Opening the same url with fopen() works properly.
 [2002-08-29 13:42 UTC] derick@php.net
I could not verify this (on Linux):

[derick@kossu derick]$ php -v
PHP 4.3.0-dev (cli), Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies

[derick@kossu derick]$ php > foo.png
<?php
$f = imagecreatefromjpeg("http://midg3t.homeip.net/images/psu-engrish.jpg");
imagepng($f);
?>

[derick@kossu derick]$ file foo.png
foo.png: PNG image data, 342 x 435, 8-bit colormap, non-interlaced


Derick
 [2002-09-25 09:38 UTC] derick@php.net
streams related...
 [2002-09-25 11:31 UTC] wez@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip

The problem is that the GD extension explicitly disables URL access under windows (it uses the IGNORE_URL_WIN flag when opening the stream).
Yesterday, I enabled this functionality along with include/require for remote files.

Please try a snapshot and let us know how you get on.
 [2002-10-08 06:57 UTC] midg3t at mail dot com
I downloaded that snapshot, maybe because of an error and maybe just because I don't have very much experience in running a PHP server, I got this error on starting Apache...

(null)(): Unable to load dynamic library 'C:\Program Files\PHP\extensions/php_gd.dll' - The specified procedure could not be found.

The php_gd.dll file is in the extensions directory, so I think it may have to do with there being a forwardslash instead of backslash. The extensions directory is configured correctly in my php.ini file.

extension_dir = "C:\Program Files\PHP\extensions"

I apologise if I have made an oversight.
 [2002-10-08 08:23 UTC] sniper@php.net
Did you remember to replace ALL the existing PHP related dlls with the ones found in the snapshot package?

php4ts.dll and all the extensions and their extra dlls.

 [2002-10-09 03:54 UTC] midg3t at mail dot com
Thanks for your help, all works fine now.

If it isn't too much trouble to ask, why would the IGNORE_URL_WIN flag have been used in the past?
 [2002-10-09 04:02 UTC] derick@php.net
PHP 4.3.0 comes with a rewritten filemanagement system (Streams) which doesn't rely on features that windows didn't implement.

Derick
 [2004-05-26 19:45 UTC] webmaster at 1zb dot de
Hi,
there must be an unreported change because the images get very dark.
Mark
 [2004-05-26 19:49 UTC] pajoye@php.net
Hello,

'images get very dark' is not very usefull.

Can you provide a link to these images and a simple script to load them? (aka imagefromjpeg(); and save them). Getting "dark" image has nothing to do with the load from URL problem, imho.

--Pierre
 [2004-05-27 08:33 UTC] derick@php.net
Right, it has nothing to do with this problem, so don't use this bugreport for it. File a new one.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 01:01:28 2024 UTC