Gaufrette icon indicating copy to clipboard operation
Gaufrette copied to clipboard

Get absolute physical path?

Open lukepass opened this issue 6 years ago • 1 comments

Hello, Sonata Media is using Gaufrette File and when I call this method of a provider:

/**
 * {@inheritdoc}
 */
public function getReferenceFile(MediaInterface $media)
{
    return $this->getFilesystem()->get($this->getReferenceImage($media), true);
}

It returns an instance of File, how can I get the absolute path after this instance? Thanks!

lukepass avatar Oct 02 '18 10:10 lukepass

Hello,

I assume you are using the local adapter. You can get the file path from the getKey method of the File instance. You then have to prefix it with the directory for which you've configured the local adapter in order to have the absolute path of the file.

nicolasmure avatar Nov 23 '18 15:11 nicolasmure

I close this stale issue. Please feel free to reopen it if necessary.

KevinArtus avatar Apr 13 '23 14:04 KevinArtus