php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #30354 imagecreatefromjpeg() requires absolute path + docs dont make that clear
Submitted: 2004-10-07 20:10 UTC Modified: 2006-03-20 19:04 UTC
From: janitor at wonkavision dot net Assigned: pajoye (profile)
Status: Not a bug Package: Documentation problem
PHP Version: 4.3.0 OS: Red Hat 9.0
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: janitor at wonkavision dot net
New email:
PHP Version: OS:

 

 [2004-10-07 20:10 UTC] janitor at wonkavision dot net
Description:
------------
The other day I spent 2 hours trying to find a bug in my code becasue imagecreatefromjpeg() requires absolute path and the docs dont make it clear that you cannot use a relative path.  There is a user comment about this, but I think it probably needs to be in the docs.

Thanks for the help!

Reproduce code:
---------------
imagecreatefromjpeg("nextdir/filename.jpg"); 


it should be something like 
imagecreatefromjpeg("var/www/project/nextdir/filename.jpg");



Expected result:
----------------
no output


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-08 08:52 UTC] derick@php.net
This is not true, there is no reason why to use the full path (alteast not on Linux). Please fill in your PHP version and operating system and provide information on how you compiled PHP.
 [2004-10-08 09:13 UTC] aidan@php.net
This is definitly not the case under windows either. I'm using GD2 (PHP 5 / PHP 4.3.9).

I suppose it is possible this is a  GD1 issue, there were many changes to the path handling. As Derick said: please provide some more information.

(Also, the second code snippet is still a relative link.)
 [2004-10-08 15:26 UTC] janitor at wonkavision dot net
Im running PHP4.3.0 on RHL9

As far as the second original snippet I left out the first slash in the comments.  In the actual code I included it.  

Is this enough info?
I cut and pasted this from phpinfo() on GD.
GD Support  enabled  
GD Version  bundled (2.0 compatible)  
FreeType Support  enabled  
FreeType Linkage  with freetype  
T1Lib Support  enabled  
GIF Read Support  enabled  
JPG Support  enabled  
PNG Support  enabled  
WBMP Support  enabled  

From Configure Command:
'./configure' '--with-gd' '--with-ttf' '--with-t1lib=/usr/local,sharedi' '--with-pear' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-jpeg-dir=/usr' '--with-gettext' '--with-dom=shared' '--with-db3=shared' '--with-interbase=shared,/usr' '--with-mysql=shared,/usr/local/mysql' '--with-pgsql=shared,/usr/local/pgsql' '--with-apxs=/usr/sbin/apxs' '--with-pdflib=shared,../pdflib-4.0.3-Linux/bind/c/' '--with-imap-ssl' '--with-imap=shared' '--with-mcrypt=shared' '--with-curl=shared' '--with-ldap=shared' '--with-regex=system' '--with-iconv' '--with-zlib' '--with-kerberos' '--enable-dba=shared' '--enable-ftp' '--enable-xml' '--enable-mbstring' '--enable-mbregex' '--disable-mbstr-enc-trans' '--enable-track-vars' '--enable-safe-mode' '--enable-memory-limit' '--enable-xslt=shared' '--with-xslt-sablot=shared'
 [2004-10-08 15:38 UTC] janitor at wonkavision dot net
One other point.  I was able to get this to work with just "file.jpg" if the image is in the same dir.  The problem showed forth once I tried to put the images in a different dir.
 [2004-12-29 18:29 UTC] mez@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.


 [2005-01-06 01:00 UTC] phpdoc at lists dot php dot net
No feedback was provided for this bug for over a week, 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".
 [2006-03-20 18:59 UTC] intro at epf dot pl
I think, its not a bug.

instead:
imagecreatefromjpeg("nextdir/filename.jpg");

use dot at the beggining, like this:
imagecreatefromjpeg("./nextdir/filename.jpg");

It should work fine!
 [2006-03-20 19:04 UTC] pajoye@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

It works well with relative path, "./file" or "file". You must use a very old very version (like gd1) or certainly not the bundled GD, in both cases it is not a php problem.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Nov 24 16:01:24 2020 UTC