File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ class _TailBlogState extends State<TailBlog> {
134134 }
135135 }
136136 //filter out posts that are missing a thumbnail
137- results = results.where ((element) => element.imageUrl != null , ).toList ();
137+ results = results.where ((element) => element.imageUrl != null ).toList ();
138138 }
139139 if (mounted && context.mounted) {
140140 setState (() {
@@ -152,7 +152,7 @@ class _TailBlogState extends State<TailBlog> {
152152 MediaDetails mediaDetails = MediaDetails .fromJson (post.self['_embedded' ]['wp:featuredmedia' ][0 ]['media_details' ]);
153153
154154 // if the post does not have a featured image, or if the featured image does not have the compressed versions created by wordpress.
155- if (mediaDetails.sizes == null || mediaDetails.sizes ! .isEmpty ) {
155+ if (mediaDetails.sizes == null ) {
156156 return null ;
157157 }
158158 if (mediaDetails.sizes! .containsKey ('medium' )) {
@@ -164,6 +164,9 @@ class _TailBlogState extends State<TailBlog> {
164164 } else if (mediaDetails.sizes! .containsKey ('full' )) {
165165 // when all else fails
166166 return mediaDetails.sizes! ['full' ]! .sourceUrl;
167+ } else if (mediaDetails.sizes! .isEmpty && mediaDetails.file != null ) {
168+ _wpLogger.warning ("Loading full size image for post: ${post .title }." );
169+ return "https://thetailcompany.com/wp-content/uploads/${mediaDetails .file }" ;
167170 }
168171 } catch (e) {
169172 _wpLogger.warning ("Unable to load featured media for post ${post .title }. $e " );
You can’t perform that action at this time.
0 commit comments