mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
* Add Bootstrap Extension * Rename main.yml * Artifact Upload * Fix Bootstrap Reference Error * BootstrapTreeProcessor * getiterator removed * keys function * Style Images * Update docs_build.yml * Added Meta Files * Template Get * Fix Page Ref * Update BASE_URL * Sort Schemas * Add Sitemaps * Add favicons, open-graph, and setup guide * Update Setup.md * Update .gitignore * Update Setup.md * Use _blank on external links * Restructured Docs * Fix Links * Added XML Schemas * Name XML Schemas * Improved Best Practices * Add Logs For Static Files * Make docs build happen on PR
22 lines
486 B
Python
22 lines
486 B
Python
from pathlib import Path
|
|
|
|
from PIL import Image
|
|
|
|
from lib.Content.StaticItem import StaticItem
|
|
|
|
|
|
class ImageStaticItem(StaticItem):
|
|
|
|
extensions = ('png', 'jpg', 'jpeg', 'webp')
|
|
|
|
sizes = {}
|
|
|
|
@classmethod
|
|
def get_size(cls, stem):
|
|
return cls.sizes.get(stem, (0, 0))
|
|
|
|
def __init__(self, path: Path):
|
|
super().__init__(path)
|
|
with Image.open(self.in_path) as img:
|
|
self.sizes[str(self.out_path.relative_to('out/').as_posix())] = img.size
|