Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display images returned in "elements" #44

Open
philgyford opened this issue May 2, 2024 · 1 comment
Open

Display images returned in "elements" #44

philgyford opened this issue May 2, 2024 · 1 comment

Comments

@philgyford
Copy link
Owner

philgyford commented May 2, 2024

I noticed that some/all articles no longer include images in the body text, while they do on theguardian.com. e.g. https://www.theguardian.com/artanddesign/2024/apr/30/delacroixs-liberty-shows-her-true-colours-after-louvre-restoration has 2 or 3 (including the first big one) images with captions. But https://content.guardianapis.com/artanddesign/2024/apr/30/delacroixs-liberty-shows-her-true-colours-after-louvre-restoration?show-elements=all&show-fields=body&api-key=test doesn't include them in the body.

But the images are included in an "elements" array (below). No indication of where they should/could go in the text, but maybe we could just add them at the end?

      "elements": [
        {
          "id": "c932f36256a5aaab31ba50359134bf12ade02f08",
          "relation": "main",
          "type": "image",
          "assets": [
            {
              "type": "image",
              "mimeType": "image/jpeg",
              "file": "https://media.guim.co.uk/c932f36256a5aaab31ba50359134bf12ade02f08/0_224_6000_3600/1000.jpg",
              "typeData": {
                "altText": "Employees of the Louvre Museum hang the restored painting of Liberty Leading the People",
                "caption": "Eugène Delacroix’s Liberty Leading the People had been under restoration for six months.",
                "credit": "Photograph: Dimitar Dilkoff/AFP/Getty Images",
                "photographer": "Dimitar Dilkoff",
                "source": "AFP/Getty Images",
                "width": "1000",
                "height": "600",
                "secureFile": "https://media.guim.co.uk/c932f36256a5aaab31ba50359134bf12ade02f08/0_224_6000_3600/1000.jpg",
                "displayCredit": "true",
                "role": "showcase",
                "mediaId": "c932f36256a5aaab31ba50359134bf12ade02f08",
                "imageType": "Photograph",
                "suppliersReference": "2150300250"
              }
            },
            {
              "type": "image",
              "mimeType": "image/jpeg",
              "file": "https://media.guim.co.uk/c932f36256a5aaab31ba50359134bf12ade02f08/0_224_6000_3600/500.jpg",
              "typeData": {
                "altText": "Employees of the Louvre Museum hang the restored painting of Liberty Leading the People",
                "caption": "Eugène Delacroix’s Liberty Leading the People had been under restoration for six months.",
                "credit": "Photograph: Dimitar Dilkoff/AFP/Getty Images",
                "photographer": "Dimitar Dilkoff",
                "source": "AFP/Getty Images",
                "width": "500",
                "height": "300",
                "secureFile": "https://media.guim.co.uk/c932f36256a5aaab31ba50359134bf12ade02f08/0_224_6000_3600/500.jpg",
                "displayCredit": "true",
                "role": "showcase",
                "mediaId": "c932f36256a5aaab31ba50359134bf12ade02f08",
                "imageType": "Photograph",
                "suppliersReference": "2150300250"
              }
            },
            {
              "type": "image",
              "mimeType": "image/jpeg",
              "file": "https://media.guim.co.uk/c932f36256a5aaab31ba50359134bf12ade02f08/0_224_6000_3600/140.jpg",
              "typeData": {
                "altText": "Employees of the Louvre Museum hang the restored painting of Liberty Leading the People",
                "caption": "Eugène Delacroix’s Liberty Leading the People had been under restoration for six months.",
                "credit": "Photograph: Dimitar Dilkoff/AFP/Getty Images",
                "photographer": "Dimitar Dilkoff",
                "source": "AFP/Getty Images",
                "width": "140",
                "height": "84",
                "secureFile": "https://media.guim.co.uk/c932f36256a5aaab31ba50359134bf12ade02f08/0_224_6000_3600/140.jpg",
                "displayCredit": "true",
                "role": "showcase",
                "mediaId": "c932f36256a5aaab31ba50359134bf12ade02f08",
                "imageType": "Photograph",
                "suppliersReference": "2150300250"
              }
            }
          ]
        },
        {
          "id": "c932f36256a5aaab31ba50359134bf12ade02f08",
          "relation": "thumbnail",
          "type": "image",
          "assets": [
            {
              "type": "image",
              "file": "https://media.guim.co.uk/c932f36256a5aaab31ba50359134bf12ade02f08/0_224_6000_3600/500.jpg",
              "typeData": {
                "altText": "Employees of the Louvre Museum hang the painting "Liberty Leading the People"",
                "credit": "Photograph: Dimitar Dilkoff/AFP/Getty Images",
                "photographer": "Dimitar Dilkoff",
                "source": "AFP/Getty Images",
                "width": "500",
                "height": "300",
                "secureFile": "https://media.guim.co.uk/c932f36256a5aaab31ba50359134bf12ade02f08/0_224_6000_3600/500.jpg",
                "displayCredit": "true",
                "mediaId": "c932f36256a5aaab31ba50359134bf12ade02f08",
                "imageType": "Photograph",
                "suppliersReference": "2150300250"
              }
            }
          ]
        },
        {
          "id": "_no_ids",
          "relation": "body",
          "type": "embed",
          "assets": [
            {
              "type": "embed",
              "file": "https://www.theguardian.com/world/2023/nov/15/louvre-acquires-24m-painting-christ-mocked-rubbish-tip-cimabue-export-ban",
              "typeData": {
                "embedType": "rich-link",
                "linkText": "Louvre acquires €24m painting originally destined for rubbish tip",
                "linkPrefix": "Related: "
              }
            }
          ]
        }
      ],
@philgyford
Copy link
Owner Author

Asked about it in the Google Group: https://groups.google.com/g/guardian-api-talk/c/3pqUQfJ28iE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant