Spamworldpro Mini Shell
Spamworldpro


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/clinic.corals.io/app/MediaLibrary/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/clinic.corals.io/app/MediaLibrary/CustomPathGenerator.php
<?php

namespace App\MediaLibrary;

use App\Models\FrontPatientTestimonial;
use App\Models\Patient;
use App\Models\Service;
use App\Models\Setting;
use App\Models\Slider;
use App\Models\User;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
use Spatie\MediaLibrary\Support\PathGenerator\PathGenerator;

/**
 * Class CustomPathGenerator
 */
class CustomPathGenerator implements PathGenerator
{
    public function getPath(Media $media): string
    {
        $path = '{PARENT_DIR}'.DIRECTORY_SEPARATOR.$media->id.DIRECTORY_SEPARATOR;

        switch ($media->collection_name) {
            case User::PROFILE;
                return str_replace('{PARENT_DIR}', User::PROFILE, $path);
            case Patient::PROFILE;
                return str_replace('{PARENT_DIR}', Patient::PROFILE, $path);
            case Setting::LOGO;
                return str_replace('{PARENT_DIR}', Setting::LOGO, $path);
            case Setting::FAVICON;
                return str_replace('{PARENT_DIR}', Setting::FAVICON, $path);
            case Slider::SLIDER_IMAGE;
                return str_replace('{PARENT_DIR}', Slider::SLIDER_IMAGE, $path);
            case FrontPatientTestimonial::FRONT_PATIENT_PROFILE;
                return str_replace('{PARENT_DIR}', FrontPatientTestimonial::FRONT_PATIENT_PROFILE, $path);
            case Service::ICON;
                return str_replace('{PARENT_DIR}', Service::ICON, $path);
            case 'default';
                return '';
        }
    }

    /**
     * @param  Media  $media
     *
     * @return string
     */
    public function getPathForConversions(Media $media): string
    {
        return $this->getPath($media).'thumbnails/';
    }

    public function getPathForResponsiveImages(Media $media): string
    {
        return $this->getPath($media).'rs-images/';
    }
}


Spamworldpro Mini