Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with path on Windows? #527

Closed
yellow1912 opened this issue Nov 18, 2014 · 3 comments
Closed

Issue with path on Windows? #527

yellow1912 opened this issue Nov 18, 2014 · 3 comments

Comments

@yellow1912
Copy link

In Liip\ImagineBundle\Binary\Loader\FileSystemLoader

we have:
$absolutePath = $this->rootPath.'/'.ltrim($path, '/');

On Windows, we will get something like:
/D:/absolute/path

Is this intentional or should it be something like:
$absolutePath = ltrim($path, '/');

@trsteel88
Copy link
Contributor

@yellow1912, the ltrim is simply trimming the $path so you don't end up with root-path//absolute-path (notice the //). From memory, the root path would normally be the absolute path to the cache directory. (eg D:/Application/web/media/cache/)

Therefore the final path would be D:/Application/web/media/cache/filename.jpg

@vinhtrinh
Copy link

Using factory instead liip_imagine.binary.loader.prototype.filesystem directly:

liip_imagine:
    loaders:
        image:
            filesystem:
                data_root: %kernel.root_dir%/../web/assets/images

Now, your actual service is: liip_imagine.binary.loader.image and use this loader to find a relative path, not an absolute.

But if an user don't care about rootPath. So, they can use the prototype above and find an absolute path. A little check on rootPath is nice

$absolutePath = (empty($this->rootPath) ? '' : $this->rootPath . '/') . ltrim($path, '/');

@michellesanver
Copy link
Contributor

@yellow1912 Did vinhtrinh's solve your issue? If not, please open a new issue if this is still an issue for you. Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants