file_exists on different subdomain?

Hello. I have 2 subdomains on my server, each running 1 side of a 2 part system. I don’t want to duplicate images across these 2 subdomains, so 1 site pulls its images from the other. That all works fine, except for if the image doesn’t exist. Is there any way for me to check if the file exists before i send it to the resizer (where getimagesize will generate an error)? Is there a way to link to files across subdomains, or do a file_exists() check? I tried “…/blah/blah” but that didn’t work…

Any suggestions would be greatly appreciated!

Thanks,
-Jack

If the two subdomains are served from the same machine, you could just use the internal path in a file_exists() check.

They are served on the same server, and i’m trying to use file_exists. It’s a path issue, i guess. I’ve tried:

example:
sub1.domain.com
sub2.domain.com trying to use file_exists() on sub1:

…/sub1/images/myfile.jpg
./sub1/images/myfile.jpg
/sub1/images/myfile.jpg
$DOCUMENT_ROOT/sub1/images/myfile.jpg
$DOCUMENT_ROOT/public_html/sub1/images/myfile.jpg
$DOCUMENT_ROOT/home/public_html/sub1/images/myfile.jpg
$_SERVER[DOCUMENT_ROOT]/sub1/images/myfile.jpg
$_SERVER[DOCUMENT_ROOT]/public_html/sub1/images/myfile.jpg
$_SERVER[DOCUMENT_ROOT]/home/public_html/sub1/images/myfile.jpg

but none of that has worked…

How about /home/public_html/sub1/images/myfile.jpg?

ahhh… i found it, there was a user name between home and public_html.

Thanks for your help!!

Sponsor our Newsletter | Privacy Policy | Terms of Service