diff --git a/app/activitypub/util.py b/app/activitypub/util.py index f1ffc1e7..eadaa228 100644 --- a/app/activitypub/util.py +++ b/app/activitypub/util.py @@ -1068,7 +1068,10 @@ def create_post(activity_log: ActivityPubLog, community: Community, request_json db.session.commit() if post.image_id: - make_image_sizes(post.image_id, 266, None, 'posts') + if post.type == POST_TYPE_IMAGE: + make_image_sizes(post.image_id, 266, 512, 'posts') # the 512 sized image is for masonry view + else: + make_image_sizes(post.image_id, 266, None, 'posts') notify_about_post(post) diff --git a/app/models.py b/app/models.py index 16dd2c03..7edfe609 100644 --- a/app/models.py +++ b/app/models.py @@ -97,6 +97,12 @@ class File(db.Model): else: return '' + def medium_url(self): + if self.file_path is None: + return self.thumbnail_url() + file_path = self.file_path[4:] if self.file_path.startswith('app/') else self.file_path + return f"https://{current_app.config['SERVER_NAME']}/{file_path}" + def thumbnail_url(self): if self.thumbnail_path is None: if self.source_url: diff --git a/app/static/structure.css b/app/static/structure.css index 44dd1c0c..40a47411 100644 --- a/app/static/structure.css +++ b/app/static/structure.css @@ -626,9 +626,9 @@ fieldset legend { } @media (min-width: 992px) { .post_list_masonry, .post_list_masonry_wide { - -webkit-column-count: 4; - -moz-column-count: 4; - column-count: 4; + -webkit-column-count: 3; + -moz-column-count: 3; + column-count: 3; -webkit-column-gap: 5px; -moz-column-gap: 5px; column-gap: 5px; diff --git a/app/static/structure.scss b/app/static/structure.scss index 3dec87d3..35362563 100644 --- a/app/static/structure.scss +++ b/app/static/structure.scss @@ -250,9 +250,9 @@ nav, etc which are used site-wide */ clear: both; @include breakpoint(tablet) { - -webkit-column-count: 4; - -moz-column-count: 4; - column-count: 4; + -webkit-column-count: 3; + -moz-column-count: 3; + column-count: 3; -webkit-column-gap: 5px; -moz-column-gap: 5px; column-gap: 5px; diff --git a/app/templates/post/_post_teaser_masonry.html b/app/templates/post/_post_teaser_masonry.html index 129298f5..7af4525a 100644 --- a/app/templates/post/_post_teaser_masonry.html +++ b/app/templates/post/_post_teaser_masonry.html @@ -12,8 +12,8 @@ {% endif %}
{% if post.type == POST_TYPE_LINK %} - {% if post.image.thumbnail_url() %} - {{ post.image.alt_text if post.image.alt_text else '' }} {% elif post.image.source_url %} {{ post.title }} {% endif %} {% elif post.type == POST_TYPE_IMAGE %} - {{ post.image.alt_text if post.image.alt_text else '' }} {% else %}