protected function AssetFileEntityHelper::getNewDestinationByUri in Media: Acquia DAM 8
Gets a new filename for an asset based on the URL returned by the DAM.
Parameters
string $destination: The destination folder the asset is being saved to.
string $uri: The URI that was returned by the DAM API for the asset.
string $original_name: The original asset filename.
Return value
string The updated destination path with the new filename.
1 call to AssetFileEntityHelper::getNewDestinationByUri()
- AssetFileEntityHelper::fetchRemoteAssetData in src/
Service/ AssetFileEntityHelper.php - Fetches binary asset data from a remote source.
File
- src/
Service/ AssetFileEntityHelper.php, line 318
Class
- AssetFileEntityHelper
- Class AssetFileEntityHelper.
Namespace
Drupal\media_acquiadam\ServiceCode
protected function getNewDestinationByUri($destination, $uri, $original_name) {
$path = parse_url($uri, PHP_URL_PATH);
$path = basename($path);
$ext = pathinfo($path, PATHINFO_EXTENSION);
$base_file_name = pathinfo($original_name, PATHINFO_FILENAME);
return sprintf('%s/%s.%s', $destination, $base_file_name, $ext);
}