meta

package
v0.0.0-...-6b90acb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProfileImageKeyPattern = "u/%s.%v"
	// ReferenceImageKeyPattern Year/Month/Day/opinionID.jpg
	ReferenceImageKeyPattern = "ref/%v/%v/%v/%v.%v"
	// 種類-talkSessionID-時間.jpg
	AnalysisImageKeyPattern = "gen/%v-%v-%v.%v"
	// 画像ID.jpg
	CommonImageKeyPattern = "i/%v.%v"
	// 組織アイコン.jpg
	OrganizationImageKeyPattern = "o/%s.%v"
)
View Source
var (
	ProfileImageValidationRule = ImageValidationRule{
								// contains filtered or unexported fields
	}
	ReferenceImageValidationRule = ImageValidationRule{
									// contains filtered or unexported fields
	}
	TalkSessionImageValidationRule = ImageValidationRule{
									// contains filtered or unexported fields
	}
	NoValidationRule = ImageValidationRule{
						// contains filtered or unexported fields
	}
)

Functions

func GetBounds

func GetBounds(ctx context.Context, file io.Reader) (int, int, error)

func GetExtension

func GetExtension(ctx context.Context, file io.Reader) (types.MIME, error)

func GetImageSize

func GetImageSize(ctx context.Context, file io.Reader) (int, error)

Types

type ImageMeta

type ImageMeta struct {
	Key       string
	Size      int
	Extension types.MIME
	Width     int
	Height    int
	Archived  bool
}

func NewImageForAnalysis

func NewImageForAnalysis(
	ctx context.Context,
	file io.Reader,
) (*ImageMeta, error)

func NewImageForCommon

func NewImageForCommon(
	ctx context.Context,
	imageID uuid.UUID,
	file io.Reader,
) (*ImageMeta, error)

func NewImageForProfile

func NewImageForProfile(
	ctx context.Context,
	userID shared.UUID[user.User],
	file io.Reader,
) (*ImageMeta, error)

ProfileIcon用の画像メタデータを生成

func NewImageForReference

func NewImageForReference(
	ctx context.Context,
	opinionID shared.UUID[opinion.Opinion],
	file io.Reader,
) (*ImageMeta, error)

ReferenceImage用の画像メタデータを生成

func NewOrganizationImage

func NewOrganizationImage(
	ctx context.Context,
	organizationID shared.UUID[organization.Organization],
	file io.Reader,
) (*ImageMeta, error)

func (*ImageMeta) Validate

func (m *ImageMeta) Validate(ctx context.Context, rule ImageValidationRule) error

type ImageValidationRule

type ImageValidationRule struct {
	Domain imageDomain
	// contains filtered or unexported fields
}

func (*ImageValidationRule) ValidAspectRatio

func (r *ImageValidationRule) ValidAspectRatio(ctx context.Context, meta ImageMeta) bool

func (*ImageValidationRule) ValidBounds

func (r *ImageValidationRule) ValidBounds(ctx context.Context, meta ImageMeta) bool

func (*ImageValidationRule) ValidExtension

func (r *ImageValidationRule) ValidExtension(ctx context.Context, meta ImageMeta) bool

func (*ImageValidationRule) ValidFileSize

func (r *ImageValidationRule) ValidFileSize(ctx context.Context, meta ImageMeta) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL