After some googling around I can say the following error is pretty common on texy-powered websites ;-) .

Warning: is_file() [function.is-file]: open_basedir restriction in effect. File is not within the allowed path(s)

I've prepaired a little patch which gets rid of this (I think) and sets a proper value for the rootPrefix variable (so Texy! can generate width and height attributes). Please review.

Comments

havran’s picture

StatusFileSize
new1.76 KB

I thinking (and testing) about this patch. But in my site i get problem with this because i have subdirectory in path in URL.

I have Drupal installed physically in directory like /data/user/jc01

From web i need go into URL like mysite.com/havran/

Texy! create physical path for checking image size with joining $texy->imageModule->rootPrefix (which in my case is /data/user/jc01) and $texy->imageModule->root (which is for me /havran/files/).

For my case $texy->imageModule->rootPrefix + $texy->imageModule->root != real physical directory with images...
For some cases is this correct because many webs don't use subdirectories in url...

I check Texy! code in texy/texy/modules/tm-image.php:

    function requireSize()
    {
        if ($this->width) return;

        $file = $this->parentModule->rootPrefix . $this->image->URL; // <- here is problem
        if (!is_file($file)) return false;

        $size = getImageSize($file);
        if (!is_array($size)) return false;

        $this->setSize($size[0], $size[1]);
    }

Maybe this is Texy! problem...

And second thing. I trying reproduce problem with open_basedir but i have no luck with this. I have modify patch - modified version attached.

archetwist’s picture

Adding base_path() resolved my problem with open_basedir restriction but the rootPrefix issue indeed looks like a bug of Texy. I'm afraid I'll be of no help here as my knowledge of PHP is poor ;-) .

And why dirname($_SERVER["SCRIPT_FILENAME"]) is better than $_SERVER['DOCUMENT_ROOT'] . '/'. Could you explain?

I trying reproduce problem with open_basedir but i have no luck with this.

Maybe it is because of different server/PHP configuration.

havran’s picture

Adding base_path() resolved my problem with open_basedir restriction but the rootPrefix issue indeed looks like a bug of Texy. I'm afraid I'll be of no help here as my knowledge of PHP is poor ;-) .

And why dirname($_SERVER["SCRIPT_FILENAME"]) is better than $_SERVER['DOCUMENT_ROOT'] . '/'. Could you explain?

Because (for example) i have my web on (physicall directory) /web/users/havran a document root for web server is /web/htdocs - for this reason we need look exactly for real path where is your index.php (Drupal index.php).

I trying reproduce problem with open_basedir but i have no luck with this.

Maybe it is because of different server/PHP configuration.

Yes, i try simulate same conditions with open_basedir settings but i have no luck.

archetwist’s picture

Status: Needs review » Fixed

As the patch is in the module and it's working I think we can mark this issue as being fixed, can't we?

Anonymous’s picture

Status: Fixed » Closed (fixed)