Skip to main content

How to programmatically attach a featured image to a Feed for the new Card View? (REST API)

Hi team! I am building a custom REST API endpoint to import real estate listings from n8n directly into my Fluent Community Hub.

I am successfully creating the posts using \FluentCommunity\App\Services\FeedsHelper::createFeed($feedData). The posts generate perfectly, and the text/HTML renders great.

The Issue: With the new "Card View" layout, I cannot get the uploaded image to display as the cover thumbnail on the card grid.

What I've tried: After createFeed(), I tried manually injecting the image data into fcom_media_archive (including calculating the serialized width/height settings) and manually updating the has_media column to 1 in both fcom_feeds and fcom_posts. Despite the database rows looking identical to a manually uploaded post, the <div class="fcom_feed_card_cover"> refuses to render on my API-generated posts.

My Question: Is there a specific Helper Class or Method (similar to createFeed) that I should be calling via PHP to programmatically attach a local image to a feed ID so that the Card View natively recognizes it?

Thanks!

Taylor Drayson

You could try setting the provider to "giphy", then you can set the image to any url. If the image already exists locally on your server, you just need the public path to the image url.