Disable image optimization?

Thoughts on disabling it? From what I read, it downsizes the image and applies compression, but then leaves the original on the server.

I’m making a photography site with thousands of images. That space costs $. I can resize my own images to 2000px and use JPEGmini and ImageOptim to compress the image myself.

Thoughts?

1 Like

Looks like you can turn it off in the config.[env].json file
https://ghost.org/docs/config/?_ga=2.258023498.1541654837.1612629606-2077328716.1612629606#image-optimisation

Reopening this, because I’m now using ghost again for a small blog, and this “solution” never worked. Not once. I’ve followed the directions on the that link to a “t” and never once has this worked.

Any Ghost devs want to step in here?

I had the same problem and I just remove _o files on the server.

I don’t even want the recompression… I can do that myself with Lightroom.

It works perfectly fine for me, on multiple sites. Make sure you’ve got a comma after the previous portion. Your config.production.json file will look something like the following. And make sure to restart Ghost after uploading the file.

{
  "url": "XXXX",
  "server": {
    "port": 2368,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "mysql",
    "connection": {
      "host": "localhost",
      "user": "ghost_843",
      "password": "XXXX",
      "database": "XXXX"
    }
  },
  "mail": {
    "transport": "SMTP",
    "from": "XXXX",
    "options": {
      "service": "Mailgun",
      "host": "smtp.eu.mailgun.org",
      "port": 465,
      "secureConnection": true,
      "auth": {
        "user": "XXXX",
        "pass": "XXXX"
      }
    }
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "XXXX"
  },
  "imageOptimization": {
    "resize": false
  }
}

I cut and pasted your code, and while it doesn’t resize the original, it doesn’t display it either. It resizes it and displays a 1600px wide image, not the 2000 px I uploaded.

You may have responsive images set up via your theme:

spoke to the developer, it’s not in the theme at all.

Tried with Casper, using the code you pasted above… when the images are displayed in a post, here’s what happens:

  1. regular photo - resized to 1600px
  2. photo expanded to fill a larger window or full page width = full size unaltered image.

Without having to resize every image, how can I have it default to the full size unaltered image?

Images in posts have srcset and sizes attributes that will give information to the browser so that it can load the most appropriately sized image for display, saving bandwidth and memory for your visitors.

If you want to disable that behaviour you can put this in your config.production.json but it will only take effect on any modified or new posts because post content is generated on save rather than dynamically every time it’s requested:

"imageOptimization": {
    "srcsets": false
}

If you want to force all posts to be re-rendered there’s a demo script here that will do that via the API api-demos/force-rerender.js at main · TryGhost/api-demos · GitHub

3 Likes

Awesome! That’s what I’ve been looking for! Will give it a shot!!!

Thanks!

A lot of people ask for this. It should really be added to the help pages.

Does anyone know if this is possible to turn off in the Ghost Pro hosted platform? All my images (Whether I put ultra high res, or compress as small as I can) appear pixelated :frowning:

Sorry for the triple post…
I didn’t realize the forums also compress a whole lot too -_-

Here is a dropbox link to the 33kb file that looks perfectly fine?

Actually, what’s more annoying is - the website compresses and has poor quality, but the email sent out to subscribers has a full HD quality of the image…