This plugin is designed to work with the Immich photos application. It allows you to store original media files in a Telegram group that you create, helping you free up significant storage space on your server.
Immich typically uses cached, smaller-sized images to load content in the app. By integrating this plugin, you can move the original images from your server to telegram storage, leaving only the smaller cached versions. When you need access to the original, high-quality images, you can generate a shared link directly from the Immich app and send it to the Telegram group where the bot is running. The bot will search for the original images and send them back on demand.
Key Features:
- Offload original media files to a Telegram group, reducing server storage usage.
- Retrieve original images on demand via a shared link sent to the Telegram bot.
-
Getting Telegram User credentials: https://gram.js.org/getting-started/authorization#logging-in-as-a-user
-
Getting Telegram Bot credentials: https://gram.js.org/getting-started/authorization#logging-in-as-a-bot
-
Rename
sample.envto.envand populate all Telegram related credentials -
Set
BASE_DIRto the Immich installation directory/library/upload -
VIDEO_COMPRESSION_LEVEL = "ultra_small_no_audio" | "ultra_small" | "small" | "medium", default value:
ultra_small- Source video size: 223 MB
medium: 6.8 MBsmall: 1.9 MBultra_small: 434 KBultra_small_no_audio: 247 KB
npm install
npm run build- Check for new files uploaded to
BASE_DIR
npm run scanYou can configure a cron job to execute this script in every 1 or 2 hour mins like
0 * * * * npm run upload- Run upload job
npm run uploadyou can configure a cron job to execute this script in every 5 or 10 mins like
*/10 * * * * npm run upload- Start the Telegram Bot to download original files
npm startOnce the files are synced in the DB, we can ask the bot for actual images. For this we need to share the Immich share link to the Telegram Bot we created.