Safe to resize original images

Hello

After 200 posts, my ghost blog is 10Gb+

I seen that many images uploaded are in very high resolution (ie pano).
But Ghost optimisation works well:

-rw-r--r-- 1 ghost ghost 281K Jan 25 07:34 IMG_8864.jpeg
-rw-r--r-- 1 ghost ghost  19M Jan 25 07:34 IMG_8864_o.jpeg

Is it safe to resize directly in this directory the _o files to 2000px max ?

And is there a way to force Ghost to regenerate the optimized images (a manual command in shell) ?

Thanks

I made a mistake and I had to recreate the files from the originals.
As nobody answered my last question, I had to find a way to do it myself.

If anybody has the same problem, this is what I’ve done:

First recreate the non-original version:

for f in *_o*.* ; do g=$(echo $f |sed s/_o//) ; if [ -f $g ] ; then cp "$g” "$f” ; else echo "$g -> $f” ;fi ; done

it will not work if you upload originals with ‘_o’ in the name…

I moved the originals in another place:

mkdir ~/ghost_originals
mv *_o*.* ~/ghost_originals

I will regularly move those originals on a dedicated bucket to save place on my server.

Then I re-optimized the pictures:

find . -print0 | xargs -0 -P8 -n2 mogrify -auto-orient -strip -thumbnail '2000x2000>' -quality 80%

This command:

  • reorient the image
  • remove the metadata
  • resize to 2000px max
  • compress to 80%

It may be not exactly the same result as before, but it saved my day.

After that, I cleaned the non-used images with ghost-purge-images

1 Like

One month (and 1000 posts) later, my blog size is 33Gb. I have 2000+ posts to migrate in order to replace my old wordpress (3200 posts in total).

So I’m considering removing all originals and put them in “cold storage”.

I saw that I need to wait that the end of the current month (ie 2021/03 right now) to do that as if I remove an original and reupload an image with the same name, the first one will be partially (thumbnails vs full size) overwritten.

@Ghost staff (@Kevin ?), is it safe to store the _o files somewhere else at the end of each “month” ? I know might have to put them back in a future ghost release in case of the need of regenerating everything

Bonus question: Is ghost-purge-image the best way to get rid of the non-used images ? Sometimes I upload an image, I see that I need to reprocess colors or cut parts, reupload again and I saw that those not-used (_o version) images are still in the year/month folder. In this case, those images could be stored elsewhere as well and maybe I don’t need ghost-purge at all.

The originals are used to generate thumbnails used by themes and other image sizes used in post image srcsets. I’d recommend not removing them but you could try optimising them to save some space.

1 Like