Skip to content

Index all image scales, no matter the actual size  #140

Open
@erral

Description

@erral

I find inconsistent that we index in the catalog metadata just some scales for an image and then requesting to the plone.restapi endpoint receiving all URLs for all configured image scales.

For instance:

This is the restapi response:

https://2023.ploneconf.org/++api++/accomodation/1111_fotpe1_fachada.jpg

"image": {
    "content-type": "image/jpeg", 
    "download": "https://2023.ploneconf.org/accomodation/1111_fotpe1_fachada.jpg/@@images/image-519-d8e3ae51320189e0d48d5032325bbab6.jpeg", 
    "filename": "1111_fotpe1_fachada.jpg", 
    "height": 600, 
    "scales": {
      "great": {
        "download": "https://2023.ploneconf.org/accomodation/1111_fotpe1_fachada.jpg/@@images/image-1200-0cb50e0c06f8f905ba111647b2512c29.jpeg", 
        "height": 600, 
        "width": 519
      }, 
      "huge": {
        "download": "https://2023.ploneconf.org/accomodation/1111_fotpe1_fachada.jpg/@@images/image-1600-f6c90960c0303e65aa57fbeb576533c0.jpeg", 
        "height": 600, 
        "width": 519
      }, 
      "icon": {
        "download": "https://2023.ploneconf.org/accomodation/1111_fotpe1_fachada.jpg/@@images/image-32-2e770277beaee989c15c5f64f550fad9.jpeg", 
        "height": 32, 
        "width": 28
      }, 
      "large": {
        "download": "https://2023.ploneconf.org/accomodation/1111_fotpe1_fachada.jpg/@@images/image-800-a56e1fb18d700a641285a81c30caca1e.jpeg", 
        "height": 600, 
        "width": 519
      }, 
      "larger": {
        "download": "https://2023.ploneconf.org/accomodation/1111_fotpe1_fachada.jpg/@@images/image-1000-71d3c8f46dbf7bd654a7d2aa0128fcfc.jpeg", 
        "height": 600, 
        "width": 519
      }, 
      "mini": {
        "download": "https://2023.ploneconf.org/accomodation/1111_fotpe1_fachada.jpg/@@images/image-200-f878c801f90e108d8236b98261b3262d.jpeg", 
        "height": 231, 
        "width": 200
      }, 
      "preview": {
        "download": "https://2023.ploneconf.org/accomodation/1111_fotpe1_fachada.jpg/@@images/image-400-c14554d35bfd7d8672bdca38d85c7ec8.jpeg", 
        "height": 462, 
        "width": 400
      }, 
      "teaser": {
        "download": "https://2023.ploneconf.org/accomodation/1111_fotpe1_fachada.jpg/@@images/image-600-102e1380a97eefef487b31a2e2dd48de.jpeg", 
        "height": 600, 
        "width": 519
      }, 
      "thumb": {
        "download": "https://2023.ploneconf.org/accomodation/1111_fotpe1_fachada.jpg/@@images/image-128-0cc82a203ab39309932391cc0e7945cd.jpeg", 
        "height": 128, 
        "width": 111
      }, 
      "tile": {
        "download": "https://2023.ploneconf.org/accomodation/1111_fotpe1_fachada.jpg/@@images/image-64-1cee74d235d28d0da7f4789e71b2f29d.jpeg", 
        "height": 64, 
        "width": 56
      }
    }, 
    "size": 273789, 
    "width": 519
  }, 

But this is the restapi response when searching for the same item:

https://2023.ploneconf.org/++api++/@search?path.query=accomodation/1111_fotpe1_fachada.jpg

"image_scales": {
        "image": [
          {
            "content-type": "image/jpeg", 
            "download": "@@images/image-519-83d59392a9853e1c02d49572d7f3d9d4.jpeg", 
            "filename": "1111_fotpe1_fachada.jpg", 
            "height": 600, 
            "scales": {
              "icon": {
                "download": "@@images/image-32-4738fb987e65577087fd99b82e06ee18.jpeg", 
                "height": 32, 
                "width": 28
              }, 
              "mini": {
                "download": "@@images/image-200-c46d75543ee91db00d59f7dc25eee6a5.jpeg", 
                "height": 231, 
                "width": 200
              }, 
              "preview": {
                "download": "@@images/image-400-ec03ddc4d1cbbce5b468673412c881b2.jpeg", 
                "height": 462, 
                "width": 400
              }, 
              "thumb": {
                "download": "@@images/image-128-70c2da4ad7ad1d535389d84a456453ee.jpeg", 
                "height": 128, 
                "width": 111
              }, 
              "tile": {
                "download": "@@images/image-64-b7e543169ac9fc5c23180ebba23ddb28.jpeg", 
                "height": 64, 
                "width": 56
              }
            }, 
            "size": 273789, 
            "width": 519
          }
        ]
      }, 

I would find much more consistent to have all of them indexed in the catalog too, otherwise the REST API user (in our case when building a Volto site), needs to do a lot of checks like "if this item hasn't the scale named large use the one named preview and if not mini, etc.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions