GithubHelp home page GithubHelp logo

apostrophecms / apostrophe-replace-original-with-full Goto Github PK

View Code? Open in Web Editor NEW
0.0 19.0 1.0 44 KB

Save space by discarding the original version of uploaded images, hardlinking them to the "full" image size. Handy if you don't need full size originals kept around.

JavaScript 100.00%

apostrophe-replace-original-with-full's Introduction

Usage:

npm install -g apostrophe-replace-original-with-full

replace-original-with-full /opt/stagecoach/apps/YOURAPP/current/public/uploads/attachments

Or, for Apostrophe 0.5.x (legacy sites only):

replace-original-with-full /opt/stagecoach/apps/YOURAPP/current/public/uploads/files

Hardlinks the "original" of each image to the "full" scaled version, greatly reducing storage requirements. However note that the true "original" is GONE FOREVER. Gone gone gone. If you have public "download the original" features, this is a terrible idea. Handy on sites with zillions of images and no requirement for high-quality originals to remain available after upload.

Often run as a cron job with the --quiet option:

0 3 * * * replace-original-with-full /opt/stagecoach/apps/YOURAPP/current/public/uploads/attachments --quiet

If you add the --link-all-sizes option, the rest of the usual Apostrophe image sizes, like one-half and one-sixth, are also symbolic links to the full size. This is NOT a good idea in production because it would force people to download full when they only need a thumbnail! But, it can be handy in a dev environment to conserve space even further.

If you add the --extra-sizes option, you can configure a comma-separated list of extra sizes beyond the standard ones. This is only relevant in combination with --link-all-sizes.

If you add the --size option, you can specify a size name other than full.

This utility is a simple shelljs script, it's not part of Apostrophe itself.

Syncing down just the full images with rsync

Those using this script in a dev environment will want to know how to copy down just the full images from their production server. This command is helpful:

rsync -a --progress --include="*/" --include="*.full.jpg" --exclude="*" [email protected]:/opt/stagecoach/apps/fandm/uploads/ public/uploads

rsync's include and exclude options are tricky; this sequence gets it done. (Include all folders, include all files with the right names, exclude everything else.)

apostrophe-replace-original-with-full's People

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

kekewind

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.