/ Troubleshooting

Images won't remove from Post in Ghost v0.5.3

As always, use documents you find on blogs at your own risk. This worked for me. It may not work for you.

Also, make sure you have good backups before you go poking around in the Ghost database.

Yeah...I know. I'm a few releases behind. For all I know, this problem is already fixed, but I'm going to write this down anywho.


My last blog post was OK, but I wanted more Pizazz!! Something that had Zing! Zork! Kapowza! Call it what you want, in any language it spells mazuma in the bank! (A little Simpsons reference for ya)

So, I clicked the little gear icon in the post editor, clicked 'Add post image', chose a nice image, clicked 'update post', and went to admire my design choice...

Oh...oh my...this looks bad. The image was too small and is REALLY pixelated after being stretched to the header size and was taking up way to much of the header for my liking.

I promptly headed back to the post editor and clicked the trash icon on the post image, but a refresh, and a refresh, and a cache clear, and a private browsing session later, the image was still there.

Not even removing it from the server's filesystem was enough. The post still had a huge header. Only this time it had no image with it. An improvement, but not enough of one.

I'm slowly becoming a DBA...

Ghost appears to use an Sqlite DB, so I started poking in the database.

sqlite3 /path/to/your/ghost.db

Now, first thing I did was turn headers on so I knew the column names

.headers on

Then I took a look at the tables.

sqlite> .tables
accesstokens       permissions        posts_tags         tags
app_fields         permissions_apps   refreshtokens      users
app_settings       permissions_roles  roles            
apps               permissions_users  roles_users      
clients            posts              settings

Can you guess which one we might need to poke at?

Find the id of the post you need to remove the image from. In this example, the post is called 'My Sooper Post'.

SELECT id, title, image FROM posts;
2|Not So Sooper|
3|Hey, I'm Trying|
4|My Sooper Post|/content/images/2015/08/ugly_image.png
6|SlingDingers 2|
7|My Magic Foobar|

We can see that the post with the title of 'My Sooper Post' has an id of 4. Let us use this info to clear the value of image.

UPDATE posts SET image='' WHERE id='4';

To confirm that that worked.

SELECT id, title, image FROM posts WHERE id='4';
4|My Sooper Post|

To really confirm it worked, load the post page that you had this issue on.