If you're running your Ghost blog from a Raspberry Pi, you're limited on how big or how many images you'll be able to host. Not by any limitations of Ghost or the Pi itself, but by the size of the SD card you've got inside that little computer.

Have no fear, there is a way to get those images hosted elsewhere (like a CDN) and for free. Enter Cloudinary. From their Wikipedia post,

Cloudinary provides a cloud-based image and video management solution. It enables users to upload, store, manage, manipulate and deliver images and video for websites and apps, with the goal of improving performance.

The images load fast too. Which is a plus if you're hosting your own site like I am. Before you continue, you need to get a free account from Cloudinary. Go ahead; I'll wait.

So, how do we get your images hosted their, for free? It's rather easy. There's a "plugin" we'll use. Well, less of a plugin and more of some code manipulation. First things first, this how-to is based on my assumption that you installed Ghost using my previous write-up.

We're going to be using Marco Mornati's GitHub fork for ghost-cloudinary-store. I implore you just to go there and get it done if you're good at messing with .json files. I wasn't, and had to figure it out, so, I'm sharing for the rest of us.

If you're dealing with a fresh install of Raspian Lite, we're going to need to install npm first.

From the command line,

sudo apt install npm

That was easy. Next, head to your Ghost root directory. It'll be at,

cd /var/www/ghost

if you let everything default when you installed it.

Next,

npm install ghost-cloudinary-store

Then make a directory we can use this in,

sudo mkdir versions/$GHOST_VERSION/core/server/adapters/storage/

From your Ghost's root we're going to do a copy and paste with:

sudo cp -r node_modules/ghost-cloudinary-store versions/$GHOST_VERSION/core/server/adapters/storage

We need to make another folder. Again, from your Ghost's root directory,

sudo mkdir /var/www/ghost/current/content/adapters/storage

And do a copy/paste move as before (from your Ghost root still),

cp -r node_modules/ghost-cloudinary-store current/content/adapters/storage/

That's the hard part; now we need to add some code to the config.production.json file.

Open your Cloudinary console up in another tab; we're going to need some data from there. You also need to open up terminal; we're going to use Nano do add some code to the .json file. From terminal,

sudo nano /var/www/ghost/config.production.json

You'll see something like

Standard config.production.json

We're going to add some code to this. The example that's given on the github page is the basic code, but we're going to add some attributes to it so we can control the size/quality of the images, and we're going to ensure that the images are sent via https vs. in the clear with http. We're going to add,

"storage": {
    "active": "ghost-cloudinary-store",
    "ghost-cloudinary-store": {
        "cloud_name": "yourCloudName",
        "api_key": "yourApiKey",
        "api_secret": "yourApiSecret",
        "configuration": {
            "quality": "auto:good",
            "secure": "true",
            "anything-else": "values"
         }
    }
}

From our Cloudinary console we need to get our "cloud name," our "api key," and "api secret" key. You should see this on Coudinary,

Screen-Shot-2018-06-30-at-9.47.10-PM

I'm not going to plug mine info in, but you get the idea. Now, we'll take that information, plug it into the right places in our little bit of code above, take that, and update our .json file.

Open up terminal again, and head to our .json file,

sudo nano /var/www/ghost/config.production.json

Placing your code into the current .json file is easy, go to the bottom and just before the second to last bracket, place a comma. Then hit return to make some space and paste your code from above in between the last bracket and the second to last. It should look something like this,

Screen-Shot-2018-06-30-at-10.21.41-PM

With your Cloudinary data in there you can save this file with Control+x, then y, then enter.

From the command line, we're going to restart Ghost,

ghost restart

If all goes well we won't throw any errors. If you do get an error, say,

Screen-Shot-2018-06-30-at-10.31.34-PM

Make sure you put that comma in the right place and you have the right amount of brackets; for every right facing bracket, you need a left facing one (open, close).

With no errors, you'll see,

Screen-Shot-2018-06-30-at-10.34.39-PM

Now, how do you know it works? Well, you can start a new story/post and add a photo to it after it's loaded you should see this:

Screen-Shot-2018-06-30-at-10.35.58-PM

Notice the link; the image is on Cloudinary!

And that's it. This is the easy way; you can add many more parameters to your code via Cloudinary documentation. But that'll get you started.

Happy blogging.