Giter Site home page Giter Site logo

paulwratt / nextcloudpi-previewgenerator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nachoparker/previewgenerator

0.0 1.0 0.0 119 KB

Nextcloud app to do preview generation

Home Page: https://apps.nextcloud.com/apps/previewgenerator

License: GNU Affero General Public License v3.0

Makefile 1.95% PHP 98.05%

nextcloudpi-previewgenerator's Introduction

Preview Generator

Nextcloud app that allows admins to pre-generate previews. The app listens to edit events and stores this information. Once a cron job is triggered it will start preview generation. This means that you can better utilize your system by pre-generating previews when your system is normally idle and thus putting less load on your machine when the requests are actually served.

The app does not replace on demand preview generation so if a preview is requested before it is pre-generated it will still be shown.

How to install

  • Install directly from within your Nextcloud from the app store
  • Clone this repository in you Nextcloud app folder

How to use the app

  1. Install the app
  2. Enable the app
  3. Run ./occ preview:generate-all once after installation.
  4. Add a (system) cron job for ./occ preview:pre-generate
  • I run it every 10 minutes

Known issues

  • The app does not work with encryption enabled

How does the app work

  1. Listen to events that a file has been written or modified and store it in the database
  2. On cron run request previews for the files that have been written or modified

If a preview already exists at step 2 then requesting it is really cheap. If not it will be generated. Depending on the sizes of the files and the hardware you are running on the time this takes can vary.

Commands

preview:delete_old

This removes the previews from the old preview location that was used before Nextcloud 11. That has some issues. Note that the gallery shipped with Nextcloud 11 did not yet use this location. So you might want to run it again with Nextcloud 12.

preview:generate-all [user-id]

Loop over all files and try to generate previews for them. If user-id is supplied just loop over the files for that user.

preview:pre-generate

Do the actual pregeneration. This means only for new or modified files (since the app was enabled or the last pregeneration was done).

FAQ

Why can't I use webcron?

Preview generation can be a very long running job. Thus we need a system that does not time out.

It sometimes crashed

Yes this happens. Most of it is due to corrupted files not being handled that gracefully in the Nextcloud server. Improvements in this area are coming with Nextcloud 12

I get "Command already running"

Yes this happens when the pre-generate command crashes. No worries the lock will be released after 30 minutes of inactivity from the app. So go grab a cookie.

I don't want to generate all the preview sizes

This is possible since version 1.0.8. Just set the correct values via the command line

./occ config:app:set --value="32 64 1024"  previewgenerator squareSizes
./occ config:app:set --value="64 128 1024" previewgenerator widthSizes
./occ config:app:set --value="64 256 1024" previewgenerator heightSizes

This will only generate:

  • square previews of: 32x32, 64x64 and 1024x1024
  • aspect ratio previews with a width of: 64, 128 and 1024
  • aspect ratio previews with a height of: 64, 256 and 1024

Note:

  • preview sizes are always a power of 2.
  • The smallest size is 32
  • The max size is determined by your preview settings in config.php

I get "PHP Fatal error: Allowed memory size of X bytes exhausted"

You need to increase the memory allowance of PHP, by default it is 128 MB. You do that by changing the memory_limit in the php.ini file.

If you use the docker container you need to create the php.ini file in /usr/local/etc/php first.

nextcloudpi-previewgenerator's People

Contributors

rullzer avatar nickvergessen avatar melroy89 avatar icewind1991 avatar chy-causer avatar mario avatar michaing avatar eeems avatar adduxa avatar bakkegaard avatar sndrr avatar

Watchers

James Cloos avatar

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.