内容丰富的CMS-获取图片 [英] Contentful CMS - getting image
问题描述
如何获取每个条目的每个图像.我有两个数组.
items
和includes
How can I get each image for each entries. I have two array.
items
and includes
例如:items.fields.name = Mark
如何获取与Mark相关的图像?
How can I get the image associated to Mark?
推荐答案
如果直接使用HTTP REST API,则需要自己进行映射.例如,如果您在items [0] .fields.image中有一个图像,则该图像将包含一个具有sys属性的对象,其中包含有关链接的实体类型(资产或条目)和id的详细信息.然后,您需要在includes数组中查找并匹配它.
If you are using the HTTP REST API directly, you'll need to do the mappings yourself. For example, if you have an image in items[0].fields.image, that will contain an object with a sys property, with details about the kind of entity that is linked (asset or entry) and the id. Then you'll need to look for that in the includes array and match it.
如果您使用 SDKs 之一,则会自动完成为你.
If you use one of the SDKs, that will be done automatically for you.
您可以在此处了解有关链接的更多信息: https://www.contentful.com /developers/docs/concepts/links/
You can read more about Links here: https://www.contentful.com/developers/docs/concepts/links/
这篇关于内容丰富的CMS-获取图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!