ghostboard / ghost-purge-images

CLI tool to display & purge the uploaded images, video and audio files that currently are not used in any post, page or meta data
MIT License
89 stars 4 forks source link

Images in use are being deleted #2

Closed Maxszik closed 5 years ago

Maxszik commented 5 years ago

After purging images I had a sense some images had dissapeared/errors. Then I made an experiment, sort of.

I added images to my ghost site by various means. I uploaded images by clicking on the add image variant, and by simply dropping them. I uploaded to galleries, and I dropped many images at once. I also uploaded images the ghost-markdown-card-way. I did it on published posts, on pages and with drafts.

The results are that images are dissapearing that should have been left alone. It seems very random and I can't see a pattern. Some images have been removed in a random way. the only pattern I might possibly see is that on a few occasions where I dropped a lot (10+) pics on the post at once, all had been purged.

So obviously something here is not working. I'm on the digitalocean droplet-variant, latest ghost.

Maxszik commented 5 years ago

Additioonal info, very unsure if it can possibly be related:

Background: I'm one of those with zero experience doing things in terminal/console, ssh and all that.

That means I was fiddling around by trial and error when A trying to install ghost-purge-images, and B trying to execute the purge command. At root, doing cd /var/www/ghost and all that, and so on. Could this possible have made any difference?

On a side note, I would like to suggest a few more instructions in the readme:

dburgos commented 5 years ago

@Caucasus-and-Mercury currently it's already on the README, you can find:

Still trying to reproduce the issue

Maxszik commented 5 years ago

Well that's kind of what I meant. It only says Run npm install -g ghost-purge-images to install, not explicitly where. As I tried to say, those things aren't that intuitive to some of us. I was also at a loss as to whether I should run the sudo -i -u ghost-mgr that Ghost suggests at the beginning, I'm still not sure. I agree the instruction of how to execute is sufficient.

Pls let me know if I could help you reproduce somehow. I now realised that I saved the terminal results after running, would you need it?

dburgos commented 5 years ago

@Caucasus-and-Mercury yes, the terminal results may help to debug. After purge the images, did you check any post or page on your blog and detect that any image was removed?

For now, I can reproduce it for draft posts & draft pages, working on a fix

dburgos commented 5 years ago

@Caucasus-and-Mercury also please note Ghost creates optimized images, so when you upload one picture, Ghost creates another one optimized with the same name but adding _o at the end. So you can get more images to delete that uploaded.

The issue about deleting images that are being used in drafts is fixed in the latest version 2.1.0, which requires Ghost +2.16 in order to use Ghost Admin API to fetch drafts.

Also the README was updated I hope you find it clearer and more useful 🙂 Feedback is welcome