On Thursday 21 February 2002 17:10, Monty wrote: > I'm having a hard time figuring out exactly how paths should be listed when > pointing to files using the ImageCreate(), ImageCopyResized(), etc. > commands. > > My images are in a sub-folder called "img", and my script is in another > sub-folder called "scripts" (at the same level as "img"). > > It appears that GetImageSize() only works for me when I put the full URL in > front of the file name like this... > > GetImageSize("http://www.mysite.com/img/photo.jpg") > > Is that the only way for this to work? The following variations all produce > an error saying it can't file the file "photo.jpg": > > GetImageSize("../img/photo.jpg") > GetImageSize("/img/photo.jpg") > GetImageSize("img/photo.jpg")
It works for me using the *full* filesystem path to the image. > At least GetImageSize() works with a URL. I can't say the same for any of > the ImageCreate() functions, which when used with all of the above path > variations including the URL, produce an error stating it can't locate the > "photo.jpg" file. Permissions for the "img" folder are set to 777, and I > can load the file using IMG SRC="/img/photo.jpg" with no problems. Why > can't I get these functions to find the file using the same path? Because "/img/photo.jpg" is relative to your DOCUMENT_ROOT. The easiest way to make sure you've got the right path is prepend the DOCUMENT_ROOT ($_SERVER['DOCUMENT_ROOT'] or $HTTP_SERVER_VARS['DOCUMENT_ROOT']). -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* Humor in the Court: Q: What is the meaning of sperm being present? A: It indicates intercourse. Q: Male sperm? A. That is the only kind I know. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php