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

Image/PathGenerator/LegacyPathGenerator.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\FieldType\Image\PathGenerator;
8
9 use eZ\Publish\Core\FieldType\Image\PathGenerator;
10
11 class LegacyPathGenerator extends PathGenerator
12 {
24 public function getStoragePathForField($fieldId, $versionNo, $languageCode)
25 {
26 return sprintf(
27 '%s/%s-%s-%s',
28 $this->getDirectoryStructure($fieldId),
29 $fieldId,
30 $versionNo,
31 $languageCode
32 );
33 }
34
42 private function getDirectoryStructure($id)
43 {
44 // our base string is the last 4 digits, defaulting to 0, reversed
45 $idString = strrev(
46 substr(str_pad($id, 4, 0, STR_PAD_LEFT), -4)
47 );
48
49 return trim(
50 chunk_split($idString, 1, '/'),
51 '/'
52 );
53 }
54 }
eZ\Publish\Core\FieldType\Image\PathGenerator\LegacyPathGenerator
Definition: Image/PathGenerator/LegacyPathGenerator.php:12
eZ\Publish\Core\FieldType\Image\PathGenerator\LegacyPathGenerator\getStoragePathForField
getStoragePathForField($fieldId, $versionNo, $languageCode)
Generates the storage path for the field identified by parameters.
Definition: Image/PathGenerator/LegacyPathGenerator.php:24
eZ\Publish\Core\FieldType\Image\PathGenerator\LegacyPathGenerator\getDirectoryStructure
getDirectoryStructure($id)
Computes a 4 levels directory structure from $id.
Definition: Image/PathGenerator/LegacyPathGenerator.php:42
eZ\Publish\Core\FieldType\Image\PathGenerator
Definition: Core/FieldType/Image/PathGenerator.php:10
eZ\Publish\Core\FieldType\Image\PathGenerator
Definition: Image/PathGenerator/LegacyPathGenerator.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.