Controller and Image

Hi,

I am trying to get an image from “Collection > User > profileImage” in a collection that I have named News. I can get other data out as Title and BIO as text element, but the Image element does not work.
What have I missed?

Kind regards, Fredrik

I found a way, I needed to pupulate the call.

        const foundUser = await user_query.findOne({
            where: {
                id: foundItem.createdBy.id,
            },
            populate: ['profileImage']
        })
1 Like

Additional resources on the topic for referece API json response does not return my uploaded image - #11 by Paul_Brats

Great to hear that you found a solution! Populating the profileImage field using await user_query.findOne and specifying the populate option is the correct way to retrieve the image from the collection.

1 Like