Image scales broken

We've had a couple instances recently in Plone 5 sites that the various image scales stopped working. The first time this happened, I was able to resave all the Images (it was a small site), and that fixed the issue.

Now it's happening in another site (Plone 5.0.6), and resaving isn't working, plus this site has a lot more images.

Some of the scales are working, like:

  • 7994652-dr.gif/@@images/image/preview
  • 7994652-dr.gif/@@images/image/

But others are not:

  • 7994652-dr.gif/@@images/6ae40958-9545-4d3e-ac4d-625fd9cda4d3.jpeg
  • 7994652-dr.gif/@@images/image.gif

Accessing these urls directly either gives a login screen or Insufficient Privileges. These are the paths used on the image_view template, and image_view_fullscreen template.

As far as I know, there is not an easy way to recreate the images scales like there was with Archetypes. Or could this be a completely different issue?

1 Like

This type of errors suggests a problem with permissions (and not the image scales themselves). You could try:

  • acessing these urls as a Zope(/Plone) "Manager" (do the errors disappear?)
  • configure "verbose security" - this usually gives good hints for the analysis of permission problems.

Having something similar happen.

.../image.png <== renders fine

.../image.png/view <=== produces blob error
.../image.png/@@images/c806fdde-ba77-4f61-b891-cd916d6b7865.png <=== produces blob error

  Module ZEO.ClientStorage, line 1020, in loadBlob
POSKeyError: 'No blob file'

Started occurring in a folder that was cut and paste elsewhere in the site.

This does not look like a permission problem but some problem at the ZODB level: "blob"s are maintained as files on the file system and apparently for one of the blobs referenced in the failing requests the corresponding file is missing.

Reasons can be various. The most natural one: the file was inadvertantly deleted. Potentially, you see also the effect of hardware problems or file system, ZODB or "copy-paste" errors.

Apparently, the image itself is still accessible -- i.e. the elementary information; what seems to be missing is something secondary. This means, you should be able to recover. I would carefully look at the traceback to find out what exactly was lost and determine from that how to get it back.

As in your case, the affected image was copied, you could delete the copy and retry the copy-and-paste operation. If the error should persist, many reasons from the list above could be excluded (e.g. file deleted, hardware problems, ...).

Could it be that you have pasted between different mountpoints or done the copy/paste in ZMI.... and then deleted the original image ?

Thanks for the response. I was thinking that perhaps the scales for the image might have been lost. I've tried recreating the scales for any images in that directory downward, and the blob issue persists. As you suggest I'll dig through the traceback a bit deeper.

I am not sure if any of those are scales: the /image is the image itself, and the preview might be 'rendered another way'.

I know that with PIL setups WITHOUT jpg and png support, the /preview is still working (this has happened when I setup Plone on a new Mac)

I also have some weird things happening with images. My image blocks are fine but teaser blocks that worked previously no longer show up. On inspection I see the image block is http://localhost:3000/section-1/webinar/@@images/image/mini and the teaser is http://localhost:3000/section-1/@@images/preview_image/great whereas. So somehow the image object webinar is missing and the image is now preview_image. If I add the image object webinar to the url manually, I still get 404 because preview_image doesn't exist. Any ideas?

After the Upgrade to Plone 6.0.7 i have sporadic errors with the display of image scales.

In a custom view, a request to the rest api get data with image scales, but the urls of the scales are not the same like under object_url/@@images-test

that is the url in the json-response:
object_url/@@images/image-1000-10b9ba6b46dbb9d211cc2818cd8cb8ad.jpeg

that is the url in the view object_url/@@images-test :
object_url/@@images/image-1000-8edc3ba8410303e3087e84adf9291799

I'm not sure if this a catalog or caching problem. I must dive in.

The JSON Request to the API:

data = {
        "query": [
          {
            "i": "portal_type",
            "o": "plone.app.querystring.operation.selection.is",
            "v": [
              "News Item"
            ]
          },
          {
            "i": "targetgroup",
            "o": "plone.app.querystring.operation.selection.any",
            "v": targetgroups
          },
          {
            "i": "is_sticky",
            "o": "plone.app.querystring.operation.boolean.isFalse",
            "v": ""
          }
        ],
        "metadata_fields": ["effective", "CreatorFullname", "targetgroup", "getIcon", "image_scales"],
        "sort_on": "effective",
        "sort_order": "descending",
        "fullobjects": false,
        "limit": 30,
        "b_start": 0,
        "b_size": 30
      };

      const options = {
        headers: {
          Accept: "application/json",
        },
        credentials: "same-origin",
        method: "GET"
      };
      
      const url = [
        portal_url(),
        "@querystring-search",
        `?query=${encodeURIComponent(JSON.stringify(data))}`
      ].join("/");

Update
The catalog metadata image_scales of the object are

{
  'image': [
     {
       'filename': 'IMG20231012110047.jpg',
       'content-type': 'image/jpeg',
       'size': 51449,
       'download': '@@images/image-1500-de2482e79d825d2a1d63c329d8f1d17c.jpeg',
       'width': 1500,
       'height': 844, 
       'scales': {
         'great': {'download': '@@images/image-1200-bb9f04de22e0b10d8b9e42f5bfea3d78.jpeg', 'width': 1200, 'height': 675},
         'larger': {'download': '@@images/image-1000-10b9ba6b46dbb9d211cc2818cd8cb8ad.jpeg', 'width': 1000, 'height': 562},
         'large': {'download': '@@images/image-800-3cbde255eda0df1a8b5e5931c10baf2d.jpeg', 'width': 800, 'height': 450},
         'teaser': {'download': '@@images/image-600-1329a9f94f32d28363c84bde16a86fc8.jpeg', 'width': 600, 'height': 337},
         'preview': {'download': '@@images/image-400-ac2e48c0dbbebc20ebd4ba2dff0a7420.jpeg', 'width': 400, 'height': 225},
         'mini': {'download': '@@images/image-200-440d85f6baa65eb81084c74f9c61e6a7.jpeg', 'width': 200, 'height': 112},
         'thumb': {'download': '@@images/image-128-25aa4195eda69a60b7e881344d07ec39.jpeg', 'width': 128, 'height': 72},
         'tile': {'download': '@@images/image-64-bc0ebc25a1230f15789349afe97739d4.jpeg', 'width': 64, 'height': 36},
         'icon': {'download': '@@images/image-32-2ff5354bac7efccff81a422d34eedd34.jpeg', 'width': 32, 'height': 18},
         'listing': {'download': '@@images/image-16-98802226b1e3d044cbcf888b02c803ed.jpeg', 'width': 16, 'height': 9}}
    }
  ]
}

The stored scales info via '@@images-test' returns for the 1000px Image:

`data:`
`fieldname: image`
`height: 562`
`key: (('fieldname', 'image'), ('height', 65536), ('mode', 'scale'), ('scale', 'larger'), ('width', 1000))`
`mimetype: image/jpeg`
`modified: 1697799261158`
`srcset: []`
`uid: image-1000-8edc3ba8410303e3087e84adf9291799`
`width: 1000`

I'm not sure what are the connections between catalog and scales. Maybe @MrTango or @mauritsvanrees know more?

Update
Reindexing of Object helps, in the ZMI -> portal_catalog -> search the brain ->klick Update Button at the bottom

Maybe this PR helps?

Released two days ago in plone.namedfile 6.2.2.

Thanks for hint, i will check it

Yip! That fixed my issue. Many thanks.

Just in case some else has the same issues as me, the NamedFile PR fixed my scaling issue with the teaser blocks but my issue with the slider blocks was resolved by pinning volto-slider-block to 4.3.0 because the instance is on volto 16. I could have moved to volto 17 but decided to hang back for.