Victrid / freshrss-image-cache-plugin

Cache feed images on your own facility or Cloudflare cache.
GNU General Public License v3.0
23 stars 5 forks source link

[QA] How to use #1

Closed squromiv closed 1 month ago

squromiv commented 1 year ago

I am newbie and do not understand how to use this extension in order to store images in local instance (Windows Apache Web Server with FreshRSS installed). Could you try to describe step by step? Should I run the other one proxy or make any config for my local server?

Victrid commented 1 year ago

Hello,

This extension itself will not cache the pictures inside FreshRSS instance. It relys on an external cache service, and will send a request to cache the image if the fetched new feed entry contains an image URL. It will rewrite the URL then user can reach the cache service instead of original image provider.

The cache service is upon your choice.

  1. If you need to cache it on your own server:

    You will need to host a image cache service yourself.

    Check this gist piccache.php to get a quick start. It is a single example server file just caching everything in image tags. This will be compatible if you are running FreshRSS, as it builds with the same technology.

    To be used without additional config, just put it in /path/to/FreshRSS/p folder (as the installation guide), and change the second line to

    define("CACHE_PLACE_PATH", "../data");

    and it will store caches in your data folder, under piccache folder. If you are accessing freshrss with address like http://192.168.1.123:4567/ then you can set the parameters as:

    cache_url: "http://192.168.1.123:4567/piccache.php?url="
    post_url: "http://192.168.1.123:4567/piccache.php"
    access_token: "Write anything and it would not check"
    url_encode: true

    This is just a simple example. It will not validate access_token or clean old caches (i.e. grows and you need to delete old files by your own). If you are familiar with Apache config, you can host it on another port, or store the cache data in another folder, which may help this file live through FreshRSS updates (maybe updates will remove the file?).

    If you are familiar with PHP or HTTP server programming, you can change or write your own server to support features you want. For example, some feeds needs tricky headers to get a picture, and you can manipulate it on your need.

  2. If you are hosting it on a VPS, or have large delay accessing the server

    If your server have 200+ms ping, it will still be painful even if you cached the picture on it. To increase the access speed, check this Cloudflare worker implementation, which will cache the pictures on the nearest cloudflare CDN network.

Victrid commented 1 year ago

BTW, please also consider update the plugin to the current version, as versions <= 0.2 have problems constructing POST requests and may cause images not being cached.

Whichbfj28 commented 12 months ago

我觉得你可以把这段话写到readme里面去。不然按照readme根本无法操作。。

ghost commented 7 months ago

The extension works great but not all images are cached, some retain their original links when there is an error like 403 Forbidden. How can i bypass such errors and make sure every image is cached

VlaK0r commented 2 months ago
  1. To be used without additional config, just put it in /path/to/FreshRSS/p folder (as the installation guide), and change the second line to
    define("CACHE_PLACE_PATH", "../data");

Please tell me, and in the case of installation via docker, where to put the file and other parameters?

Victrid commented 1 month ago

I have updated the README.md, which covered this issue. If you still have problem please open a new one.