Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 4s
Build & Deploy / 🧪 QA (push) Successful in 2m55s
Build & Deploy / 🏗️ Build (push) Successful in 11m40s
Build & Deploy / 🚀 Deploy (push) Failing after 8s
Build & Deploy / 🩺 Health Check (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 1s
43 lines
877 B
TypeScript
43 lines
877 B
TypeScript
import type { CollectionConfig } from "payload";
|
|
import path from "path";
|
|
import { fileURLToPath } from "url";
|
|
|
|
const filename = fileURLToPath(import.meta.url);
|
|
const dirname = path.dirname(filename);
|
|
|
|
export const Media: CollectionConfig = {
|
|
slug: "media",
|
|
admin: {
|
|
useAsTitle: "filename",
|
|
defaultColumns: ["filename", "alt", "updatedAt"],
|
|
},
|
|
access: {
|
|
read: () => true, // Publicly readable
|
|
},
|
|
upload: {
|
|
staticDir: path.resolve(dirname, "../../../public/media"),
|
|
adminThumbnail: "thumbnail",
|
|
imageSizes: [
|
|
{
|
|
name: "thumbnail",
|
|
width: 400,
|
|
height: 300,
|
|
position: "centre",
|
|
},
|
|
{
|
|
name: "card",
|
|
width: 768,
|
|
height: undefined,
|
|
position: "centre",
|
|
},
|
|
],
|
|
},
|
|
fields: [
|
|
{
|
|
name: "alt",
|
|
type: "text",
|
|
required: true,
|
|
},
|
|
],
|
|
};
|