Page 1 of 1

getimagesize from different document root

Posted: Thu May 26, 2005 4:34 am
by hessodreamy
The website I am working on uses getimagesize to rescale images.
We're setting up a new site using the same images, but am having trouble getting the image size. I think its because of the images being in a different document root to the script, though it displays the image fine.

We're getting the image size like so:

Code: Select all

list($width, $height, $type, $whstr) = getimagesize('../../~gan1/images/summarypics/2211.jpg');
This function returns false, and the error message:

Code: Select all

Warning: getimagesize(../../~gan1/images/summarypics/2211.jpg): failed to open stream: No such file or directory
Though, like I said, the image then displays, completely oblivious to the troble its causing me.

Posted: Thu May 26, 2005 5:37 am
by JayBird
Please take the time to post in the correct section :roll:

Posted: Thu May 26, 2005 5:44 am
by hessodreamy
Which section should I Post in? This section is regarding coding. The 'general discussion' section didnt seem relevant.

Posted: Thu May 26, 2005 5:49 am
by shiznatix
hessodreamy wrote:Which section should I Post in? This section is regarding coding. The 'general discussion' section didnt seem relevant.

uhhh if the gerneral discussion section did not seam relevant than why did you post it there first?

ok no lectures, so the only problem your having is the error popping up? well you can always

Code: Select all

error_reporting(E-NONE);
but that is not a very wise idea but if its just the error thats showing up while the function seams to work then why not?

Posted: Thu May 26, 2005 6:18 am
by Bennettman
Edit: Got mixed up between server path and browser path.

Posted: Thu May 26, 2005 9:53 am
by pickle
Actually, I know you can go outside the document root. Try using an absolute path rather than a relative one (use "/home/gan/images[and so on]"). This also makes the code work regardless of where it is on your server.