avatarbabe / gridsome-source-directus9

1 stars 4 forks source link

When downloadImages: true, gridsome_image is null #3

Open stefanisarie opened 3 years ago

stefanisarie commented 3 years ago

Hi!

I'm trying to download all the images from a collection and link them using g-image. The download of images works fine, the problem is that gridsome_image key in the collection is always null while it should be populated with loads of data (path to downloaded image for example).

Is there any other step I need to configure to have "gridsome_image" correctly populated with data?

Thank you!

avatarbabe commented 3 years ago

Hello, I haven't been able to maintain this project for a while. As a result, it's not up to date with the latest Directus versions. It's still using the old SDK and there might be some things that simply do not work anymore.

Unfortunately, I don't have time to look into this any time soon. I think you're better off using the SDK and building your own Gridsome integration. You can fork this repo so you have something to start with, or if you want, submit a pull-request to this repo.

I know it's not the answer you were hoping for, but I wish you all the best!

avatarbabe commented 3 years ago

If you send over your configuration, I could take a quick look to see if there is something obvious missing :) The most common pitfall is the 'fields' query-parameter that is not correctly configured

stefanisarie commented 3 years ago

Hey!

My configuration looks like this:

{
  use: "gridsome-source-directus9",
  options: {
    apiUrl: "https://the.url/",
    project: "TheProject",
    email: "email@address.com",
    password: "Password1234",
    collections: [
      {
        name: 'clients',
        status: 'published',
        fields: '*.*.*',
        downloadImages: true
      },
    ],
  },
}

Thank you!

stefanisarie commented 3 years ago

This is how "gridsome_image" would look like on Directus 8:

{
  "directus_files_id": {
    "id": 80,
    "title": "20819632 1478311842247482 7338836853313174022 O",
    "width": 2048,
    "height": 1365,
    "gridsome_image": {
      "type": "image",
      "mimeType": "image/jpeg",
      "src": "/assets/static/.cache-directus/img-cache/fea8a9db-f976-4c60-af26-7e5ba9005885.jpg?width=2048&fit=cover&blur=20&key=215a2f9",
      "size": {
        "width": 2048,
        "height": 1365
      },
      "sizes": "(max-width: 2048px) 100vw, 2048px",
      "srcset": [
        "/assets/static/.cache-directus/img-cache/fea8a9db-f976-4c60-af26-7e5ba9005885.jpg?width=480&fit=cover&blur=20&key=215a2f9 480w",
        "/assets/static/.cache-directus/img-cache/fea8a9db-f976-4c60-af26-7e5ba9005885.jpg?width=1024&fit=cover&blur=20&key=215a2f9 1024w",
        "/assets/static/.cache-directus/img-cache/fea8a9db-f976-4c60-af26-7e5ba9005885.jpg?width=2048&fit=cover&blur=20&key=215a2f9 2048w"
      ],
      "dataUri": "data:image/svg+xml,%3csvg fill='none' viewBox='0 0 2048 1365' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cdefs%3e%3cfilter id='__svg-blur-4ec14479b512767969be30dd9d849ccd'%3e%3cfeGaussianBlur in='SourceGraphic' stdDeviation='20'/%3e%3c/filter%3e%3c/defs%3e%3cimage x='0' y='0' filter='url(%23__svg-blur-4ec14479b512767969be30dd9d849ccd)' width='2048' height='1365' xlink:href='data:image/jpeg%3bbase64%2c/9j/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAArAEADASIAAhEBAxEB/8QAGQABAQEBAQEAAAAAAAAAAAAABQQGAwcB/8QALxAAAgEDAwIEBQMFAAAAAAAAAQIDAAQRBRIhBjETIkFRBzJhcZEUgbEVI2Khwf/EABcBAQEBAQAAAAAAAAAAAAAAAAMBAgT/xAAdEQACAgMBAQEAAAAAAAAAAAAAAQIhETFRAxJB/9oADAMBAAIRAxEAPwCO/wDiheagxaOyhGTzvYsT%2bOKoHxE1MW%2bIYbGErgZYMxP1FeMadNMZgiZLYOAPtSj3csRZQ%2bGzyp%2b1Yl5x4L9Pp6za/EfV5r3CGzEW0uwMJwqqCWPfJ4FQXfX/AFJbTWkk0kaLPF%2boSPw1YFGzjdwMH6fzWF0W7Mena/PJ5misGVB35dlUn9hmu/SJ0zVluLHVZ7xb9o1S3uAd0Vsq5Azk5POc545oXBJuqQquOM2xq/8AiL1NOJU37Q6GMtHGqhQT3GOx%2btC33VPUFyqM13MWWA2%2bQcZQ98%2b5%2bvejdbaXTLm5s79LYT2%2bFZckZP0weeOc0BLPDPHJIktys4XIULlc%2b3elj5rhyy9JaYpe9SdSyho5NWu3DY4DkAY7dqz1yb5hiSeRwPdycV8W3uLjJUN9zxXeOzmhjJZxk8YzSVHRLexTTHfwyh8Hcw%2bb2FNJbR3sUamOBdpAaVMh29wfT/VAafcMDkNHnPcinUvYWt5FnmCgjaWjTDLnjjHrRSm9IZJO2cv6taPqzR30czxS4iknKhSq425OO4xz71nLW%2bSzMnjqX4IRg%2bOdwIyPUd/zUF622WRVI2g4Xb2xU3gliuzkkZIHpTpBvhsZbibq3V7uRbKR5JpDPNIEIES47Z5woA7VTfaI7W9vFHdRQiPJVgQCwPPNHdD9Ry9OOz2alZJOJJAfMV9sHj7VoZZNMvXe42ySNIdxOccnk8dh9q5/SThhLRcKVvYDNpMyeU6iXP3zmor3S7gLg3Tds4yOfrT11JppPhhZdwzjzHihri5jG4JIc/KCfapGcmVxQha9G60duLXI/wAXU/8Aaqv%2bmtVgsgxtJ/Idx/tk/wAVqLK5mCjEjfmrv1MzjY0r7W4I3elacXnOTaSPGdQtJInPY7jlQO5z6D3rtFpt7AVlFnM2DjyjcD%2bPStPq9jb299eSwoUlR/KwdsjPf1qSHV74tsefeoGAHVWx%2bRSNv8MY6Bx2rLbu7W8guSd8fpjHzKQfpz%2b9VaLNM9vcGNm2xsGwPXivnU1zKBEyvtMgIbaAM/ilNHRbfSrbwRt8VQz%2buSaz6XEiVkTXGIiWY7jzgj1o%2b6wrEhDsIBBz2NJ30jLOUGNpUZGBzyaPvQDGuR7UcaK%2bH//Z' /%3e%3c/svg%3e"
    },
    "metadata": null
  }
}
RegisHubelia commented 3 years ago

Hey, I've forked this branch and made quite a few changes in order to get this to work. Basically, not sure why yet, but gridsome/graphql doesn't like the full file path with the "/".

Anyways, I forked this repo and made quite a few changes to make it work as I needed the functionality. I still have some work to do on it tough, so don't be too critic, but it should work giving you a similar object to your previous post.

The fork is @ https://github.com/Hubelia/gridsome-source-directus9 if you want to have a look.