I need to use getLocalCopy from LocalAssetSourceType

// Get asset source
$source = $asset->getSource();
// Get asset source type
$sourceType = $source->getSourceType();
// Get asset file
$file = $sourceType->getLocalCopy($asset);

but that function returns the error Tried to copy 2015/ami-l.jpg to /twenrytn/unidram/craft/storage/runtime/temp/assets56050ef792f4e1.75513363.jpg, but the source file does not exist.

The source file definitely exists, so i checked the function itself

public function getLocalCopy(AssetFileModel $file)
    $location = AssetsHelper::getTempFilePath($file->getExtension());
      MyPlugin::log($this->_getFileSystemPath($file) . ' > ' . $location);
    IOHelper::copyFile($this->_getFileSystemPath($file), $location);
    return $location;

and the log returned 2015/ariel-doron-xl.jpg > /twenrytn/unidram/craft/storage/runtime/temp/assets5605112c1aef83.12097209.jpg

I think $this->_getFileSystemPath($file) should return an absolute path. Why didnt it?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.