diff --git a/homepage/models.py b/homepage/models.py index d103081..e0eefdf 100755 --- a/homepage/models.py +++ b/homepage/models.py @@ -38,6 +38,14 @@ class Location (models.Model): draw.text((x,y), text, font=font, fill=(255,255,255)) img.save(output) + def add_margin(pil_img, top, right, bottom, left, color): + width, height = pil_img.size + new_width = width + right + left + new_height = height + top + bottom + result = Image.new(pil_img.mode, (new_width, new_height), color) + result.paste(pil_img, (left, top)) + return result + self.slug = slugify(self.name) self.hero = f'heros/hero-{self.slug}.png' self.hero_mobile = f'heros/hero-{self.slug}-mobile.png' @@ -66,7 +74,7 @@ class Location (models.Model): drawPic(mobile_output, mobile_output, font, 100, 1470, self.slug.upper()) drawPic(mobile_output, mobile_output, font, 100, 1570, self.slug.upper()) mobile_img = Image.open(mobile_output) - mobile_img.resize((1920, 1080)) + mobile_img = mobile_img.resize((1080, 1920)) mobile_img.save(mobile_output) output = f'{settings.PROJECT_PATH}/media/results/results-{self.slug}.png' diff --git a/homepage/templates/homepage/index.html b/homepage/templates/homepage/index.html index 9408683..acecbb6 100755 --- a/homepage/templates/homepage/index.html +++ b/homepage/templates/homepage/index.html @@ -11,7 +11,14 @@ @media (max-width: 768px) { .hero { - background-image: url("{{ location.hero_mobile.url }}"); + background: url("{{ location.hero_mobile.url }}"); + background-attachment: fixed + background-repeat: no-repeat; + background-position: center center; + -webkit-background-size: cover; + -moz-background-size: cover; + -o-background-size: cover; + background-size: cover; } } @@ -24,8 +31,7 @@
inspired by a family tradition of “high, low, buffalo”, a fun exercise @@ -87,8 +93,7 @@ {% endfor %}
NOW IS YOUR TIME TO SHINE
#} +NOW IS YOUR TIME TO SHINE
#HILOW
BONUS QUESTION
#} +BONUS QUESTION