Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

BinaryBase/PathGenerator/LegacyPathGenerator.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\FieldType\BinaryBase\PathGenerator;
8
9 use eZ\Publish\SPI\FieldType\BinaryBase\PathGenerator;
10 use eZ\Publish\SPI\Persistence\Content\VersionInfo;
11 use eZ\Publish\SPI\Persistence\Content\Field;
12
13 class LegacyPathGenerator extends PathGenerator
14 {
15 public function getStoragePathForField(Field $field, VersionInfo $versionInfo)
16 {
17 $extension = pathinfo($field->value->externalData['fileName'], PATHINFO_EXTENSION);
18
19 return $this->getFirstPartOfMimeType($field->value->externalData['mimeType'])
20 . '/' . md5(uniqid(microtime(true), true))
21 . (!empty($extension) ? '.' . $extension : '');
22 }
23
31 protected function getFirstPartOfMimeType($mimeType)
32 {
33 return substr($mimeType, 0, strpos($mimeType, '/'));
34 }
35 }
eZ\Publish\Core\FieldType\BinaryBase\PathGenerator\LegacyPathGenerator
Definition: BinaryBase/PathGenerator/LegacyPathGenerator.php:14
eZ\Publish\Core\FieldType\BinaryBase\PathGenerator\LegacyPathGenerator\getFirstPartOfMimeType
getFirstPartOfMimeType($mimeType)
Extracts the first part (before the '/') from the given $mimeType.
Definition: BinaryBase/PathGenerator/LegacyPathGenerator.php:31
eZ\Publish\Core\FieldType\BinaryBase\PathGenerator\LegacyPathGenerator\getStoragePathForField
getStoragePathForField(Field $field, VersionInfo $versionInfo)
Definition: BinaryBase/PathGenerator/LegacyPathGenerator.php:15
eZ\Publish\SPI\FieldType\BinaryBase\PathGenerator
Definition: SPI/FieldType/BinaryBase/PathGenerator.php:16
eZ\Publish\SPI\Persistence\Content\Field
Definition: SPI/Persistence/Content/Field.php:12
eZ\Publish\SPI\Persistence\Content\VersionInfo
This class holds version information data.
Definition: SPI/Persistence/Content/VersionInfo.php:15
eZ\Publish\Core\FieldType\BinaryBase\PathGenerator
Definition: BinaryBase/PathGenerator/LegacyPathGenerator.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.