![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/ts.corals.io/corals-api/Corals/core/Media/Classes/ |
<?php namespace Corals\Media\Classes; use Spatie\MediaLibrary\MediaCollections\Models\Media; use Spatie\MediaLibrary\Support\PathGenerator\PathGenerator; class CoralsPathGenerator implements PathGenerator { /* * Get the path for the given media, relative to the root storage path. */ public function getPath(Media $media): string { return $this->getBasePath($media) . '/'; } /* * Get the path for conversions of the given media, relative to the root storage path. */ public function getPathForConversions(Media $media): string { return $this->getBasePath($media) . '/conversions/'; } /* * Get the path for conversions of the given media, relative to the root storage path. */ public function getPathForResponsiveImages(Media $media): string { return $this->getBasePath($media) . '/responsive/'; } /* * Get a (unique) base path for the given media. */ protected function getBasePath(Media $media): string { $root = $media->getCustomProperty('root', 'user_' . optional(user())->hashed_id); $key = $media->getCustomProperty('key', $media->getKey()); return $root . '/' . $key; } }