/** * Return the directory where all files of the given media are stored. * * @param \Spatie\MediaLibrary\Media $media * * @return string */ public function getMediaDirectory(Media $media) { $this->disk->put('.gitignore', Gitignore::getContents()); $directory = $media->id; $this->disk->makeDirectory($directory); $this->disk->makeDirectory($directory . '/conversions'); return $directory; }
/** * Return the directory where all files of the given media are stored. * * @param \Spatie\MediaLibrary\Media $media * * @return string */ public function getMediaDirectory(Media $media) { $this->filesystems->disk($media->disk)->put('.gitignore', Gitignore::getContents()); $directory = $media->id; $this->filesystems->disk($media->disk)->makeDirectory($directory); return $directory; }
/** * Return the directory where all files of the given media are stored. * * @param \Spatie\MediaLibrary\Media $media * * @return string */ public function getMediaDirectory(Media $media, $conversion = false) { $this->filesystems->disk($media->disk)->put('.gitignore', Gitignore::getContents()); $pathGenerator = PathGeneratorFactory::create(); $directory = $conversion ? $pathGenerator->getPathForConversions($media) : $pathGenerator->getPath($media); $this->filesystems->disk($media->disk)->makeDirectory($directory); return $directory; }