Commit 4a8147bf authored by Yassine Doghri's avatar Yassine Doghri
Browse files

feat: add podcast banner field for each podcast + refactor images configuration

- rename image fields on podcast, episode and persons for better clarity
- set different sizes
config for podcast cover, banner and persons avatars
- add tiny size for covers
- fix responsive
on admin forms
parent 5c56f3e6
Loading
Loading
Loading
Loading
+47 −26
Original line number Diff line number Diff line
@@ -32,42 +32,63 @@ class Images extends BaseConfig

    /*
    |--------------------------------------------------------------------------
    | Uploaded images resizing sizes (in px)
    | Uploaded images sizes (in px)
    |--------------------------------------------------------------------------
    | The sizes listed below determine the resizing of images when uploaded.
    | All uploaded images are of 1:1 ratio (width and height are the same).
    */

    public int $thumbnailSize = 150;

    public int $mediumSize = 320;

    public int $largeSize = 1024;

    /**
     * Size of images linked in the rss feed (should be between 1400 and 3000)
     * Podcast cover image sizes
     *
     * Uploaded podcast covers are of 1:1 ratio (width and height are the same).
     *
     * Size of images linked in the rss feed (should be between 1400 and 3000). Size for ID3 tag cover art (should be
     * between 300 and 800)
     *
     * Array values are as follows: 'name' => [width, height]
     *
     * @var array<string, int[]>
     */
    public int $feedSize = 1400;
    public array $podcastCoverSizes = [
        'tiny' => [40, 40],
        'thumbnail' => [150, 150],
        'medium' => [320, 320],
        'large' => [1024, 1024],
        'feed' => [1400, 1400],
        'id3' => [500, 500],
    ];

    /**
     * Size for ID3 tag cover art (should be between 300 and 800)
     */
    public int $id3Size = 500;

    /*
    |--------------------------------------------------------------------------
    | Uploaded images naming extensions
    |--------------------------------------------------------------------------
    | The properties listed below set the name extensions for the resized images
     * Podcast header cover image
     *
     * Uploaded podcast header covers are of 3:1 ratio
     *
     * Array values are as follows: 'name' => [width, height]
     *
     * @var array<string, int[]>
     */
    public array $podcastBannerSizes = [
        'small' => [320, 128],
        'medium' => [960, 320],
        'large' => [1500, 500],
    ];

    public string $thumbnailSuffix = '_thumbnail';

    public string $mediumSuffix = '_medium';

    public string $largeSuffix = '_large';
    public string $podcastBannerDefaultPath = 'castopod-banner-default.jpg';

    public string $feedSuffix = '_feed';
    public string $podcastBannerDefaultMimeType = 'image/jpeg';

    public string $id3Suffix = '_id3';
    /**
     * Person image
     *
     * Uploaded person images are of 1:1 ratio (width and height are the same).
     *
     * Array values are as follows: 'name' => [width, height]
     *
     * @var array<string, int[]>
     */
    public array $personAvatarSizes = [
        'tiny' => [40, 40],
        'thumbnail' => [150, 150],
        'medium' => [320, 320],
    ];
}
+2 −2
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ class CreditsController extends BaseController
                            $personId => [
                                'full_name' => $credit->person->full_name,
                                'thumbnail_url' =>
                                    $credit->person->image->thumbnail_url,
                                    $credit->person->avatar->thumbnail_url,
                                'information_url' =>
                                    $credit->person->information_url,
                                'roles' => [
@@ -87,7 +87,7 @@ class CreditsController extends BaseController
                    $credits[$personGroup]['persons'][$personId] = [
                        'full_name' => $credit->person->full_name,
                        'thumbnail_url' =>
                            $credit->person->image->thumbnail_url,
                            $credit->person->avatar->thumbnail_url,
                        'information_url' => $credit->person->information_url,
                        'roles' => [
                            $personRole => [
+6 −6
Original line number Diff line number Diff line
@@ -200,11 +200,11 @@ class EpisodeController extends BaseController
                '" width="100%" height="144" frameborder="0" scrolling="no"></iframe>',
            'width' => 600,
            'height' => 144,
            'thumbnail_url' => $this->episode->image->large_url,
            'thumbnail_url' => $this->episode->cover->large_url,
            'thumbnail_width' => config('Images')
                ->largeSize,
                ->podcastCoverSizes['large'][0],
            'thumbnail_height' => config('Images')
                ->largeSize,
                ->podcastCoverSizes['large'][1],
        ]);
    }

@@ -219,9 +219,9 @@ class EpisodeController extends BaseController
        $oembed->addChild('provider_url', $this->podcast->link);
        $oembed->addChild('author_name', $this->podcast->title);
        $oembed->addChild('author_url', $this->podcast->link);
        $oembed->addChild('thumbnail', $this->episode->image->large_url);
        $oembed->addChild('thumbnail_width', config('Images')->largeSize);
        $oembed->addChild('thumbnail_height', config('Images')->largeSize);
        $oembed->addChild('thumbnail', $this->episode->cover->large_url);
        $oembed->addChild('thumbnail_width', config('Images')->podcastCoverSizes['large'][0]);
        $oembed->addChild('thumbnail_height', config('Images')->podcastCoverSizes['large'][1]);
        $oembed->addChild(
            'html',
            htmlentities(
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ class MapMarkerController extends BaseController
                    'location_url' => $episode->location->url,
                    'episode_link' => $episode->link,
                    'podcast_link' => $episode->podcast->link,
                    'image_path' => $episode->image->thumbnail_url,
                    'cover_path' => $episode->cover->thumbnail_url,
                    'podcast_title' => $episode->podcast->title,
                    'episode_title' => $episode->title,
                ];
+14 −2
Original line number Diff line number Diff line
@@ -46,16 +46,28 @@ class AddPodcasts extends Migration
            'description_html' => [
                'type' => 'TEXT',
            ],
            'image_path' => [
            'cover_path' => [
                'type' => 'VARCHAR',
                'constraint' => 255,
            ],
            // constraint is 13 because the longest safe mimetype for images is image/svg+xml,
            // see https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#image_types
            'image_mimetype' => [
            'cover_mimetype' => [
                'type' => 'VARCHAR',
                'constraint' => 13,
            ],
            'banner_path' => [
                'type' => 'VARCHAR',
                'constraint' => 255,
                'null' => true,
                'default' => null,
            ],
            'banner_mimetype' => [
                'type' => 'VARCHAR',
                'constraint' => 13,
                'null' => true,
                'default' => null,
            ],
            'language_code' => [
                'type' => 'VARCHAR',
                'constraint' => 2,
Loading