|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
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<?php imagecreatefromjpeg("http://midg3t.homeip.net/images/psu-engrish.jpg"); ?>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