How to prevent an image from being clickable (remove lightbox)

Is there a way to insert an image without wrapping it in a clickable lightbox?

I think small images are not clickable:

CleanShot 2022-08-11 at 08.27.29@2x

This only seems to be a issue with large images:

I thought disabling responsive post image sizes and create thumbnails would do the trick, but apparently not.

This is what I see:


I think thumbnails are generating by max image width and max image height by default. If the uploaded image smaller than these values, thumbnail will not creating.
Screenshot 2022-08-11 at 10.59.53

If you want to disable thumbnails creation, uncheck this settings. It will only disable thumbnail for the future uploads, no matter how big is the image.

I didn’t find any relevant information about that how to disable thumbnails from older uploads but if enough to you to hide these with simple CSS. This workaround might work. :slightly_smiling_face:

Common / CSS

.cooked {
  .lightbox-wrapper {
    a.lightbox {
      pointer-events: none; // Disable all click events on image
      &:hover {
        box-shadow: none;
      .meta {
        display: none;

Thanks, that works great. Are lightboxes used anywhere else or only on images? I’m afraid that might cause problems elsewhere. :sweat_smile:


I think .lightbox is only used for post image thumbnail but I updated the code above to be more specific. :slightly_smiling_face:


Hey @Nacho_Caballero, I think I found a possible (better) solution. :slightly_smiling_face:

I checked it again and unfortunately the thumbnail creating even if I disable it on settings. I don’t know actually how because first time it worked for me. :thinking:

But as I mentioned here :arrow_down_small:

I think if you increase these values, thumbnail could be disable on older uploads too.

I increased these to 99999 a high number and it prevents creating thumbnail under these value.

On older posts you can use Rebuild HTML or rebake posts (will change it on all posts) to remove thumbnails.

cd /var/discourse
./launcher enter app
rake posts:rebake


I think you just need to rebake those posts. Rebake all posts matching a pattern

1 Like

First I thought that too, but didn’t work. Actually only this How to prevent an image from being clickable (remove lightbox) - #6 by dodesz worked for me to remove thumbnails. I think maybe the max image width and max image height is override the create thumbnails setting.

1 Like