Simplify images, tag overview
This commit is contained in:
@ -76,6 +76,33 @@ final class FileResource: Item {
|
||||
Image(systemSymbol: .exclamationmarkTriangle)
|
||||
}
|
||||
|
||||
/// The path to the output folder where image versions are stored (no leading slash)
|
||||
var outputImageFolder: String {
|
||||
"\(content.settings.paths.imagesOutputFolderPath)/\(id.fileNameWithoutExtension)"
|
||||
}
|
||||
|
||||
func outputPath(width: Int, height: Int, type: FileType?) -> String {
|
||||
let prefix = "/\(outputImageFolder)/\(width)x\(height)"
|
||||
guard let ext = type?.fileExtension else {
|
||||
return prefix
|
||||
}
|
||||
return prefix + "." + ext
|
||||
}
|
||||
|
||||
func imageSet(width: Int, height: Int, language: ContentLanguage, quality: CGFloat = 0.7) -> ImageSet {
|
||||
let description = self.localized(in: language)
|
||||
return .init(
|
||||
image: self,
|
||||
maxWidth: width,
|
||||
maxHeight: height,
|
||||
description: description,
|
||||
quality: quality)
|
||||
}
|
||||
|
||||
func imageVersion(width: Int, height: Int, type: FileType) -> ImageVersion {
|
||||
.init(image: self, type: type, maximumWidth: width, maximumHeight: height)
|
||||
}
|
||||
|
||||
// MARK: Paths
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user