Skip to content

Commit

Permalink
Merge f7e489e into 34407ac
Browse files Browse the repository at this point in the history
  • Loading branch information
midstar committed Jan 10, 2020
2 parents 34407ac + f7e489e commit a992216
Show file tree
Hide file tree
Showing 19 changed files with 1,088 additions and 196 deletions.
19 changes: 19 additions & 0 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- [How do I view my media?](#how-do-i-view-my-media)
- [Why are the Video thumbnails not generated?](#why-are-the-video-thumbnails-not-generated)
- [Why does it take so long time to load images the first time?](#why-does-it-take-so-long-time-to-load-images-the-first-time)
- [Why is swiping or zooming images lagging?](#why-is-swiping-or-zooming-images-lagging)


## Why use MediaWEB and not any other similar software?
Expand Down Expand Up @@ -55,3 +56,21 @@ Also, MediaWEB can generate thumbnails as soon as files are added to the media d
genthumbsonadd = on

This will improve performance a lot the first time each folder is browsed.

## Why is swiping or zooming images lagging?

By default the original images are opened in the viewer. If the images are large (typical 2 - 10 MB) low end platforms (such as mobile browsers) will have a hard time to make a smooth navigation / zooming. Also, it make take some time to download the images if the network bandwidth is limited.

This can be fixed by automatically resizing the images on the server side by enabling image preview with following configuration parameter:

enablepreview = on

It will take some time for the server to resize the image, but once the image has been resized, it will be cached in the same location as the thumbnails. Next time the image is viewed it will be blazing fast. You can also configure MediaWEB to resize the images on startup with *genpreviewonstartup* configuration parameter.

The size of the preview images is set with the previewmaxside configuration parameter. To limit the height and width to 1000 pixels, set:

previewmaxside = 1000

The aspect ratio of the image will be kept.

Your can also configure MediaWEB to generate the previews during startup and when files are added to the media folder as described in the [configuration guide](README.md).
58 changes: 54 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ No additional stuff, such as dockers and similar is required.

MediaWEB is well suited to run on small platforms such as Raspberry Pi, Banana Pi, ROCK64 and similar. It is still very fast and can be used with advantage on PC:s running Windows, Linux or Mac OS.

## Content

- [Screenshots](#screenshots)
- [Features](#features)
- [Download and install Linux](#download-and-install-linux)
- [Download and install on Windows](#download-and-install-on-windows)
- [Build from source on any platform](#build-from-source-on-any-platform)
- [Configuration guide](#configuration-guide)
- [Future improvements](#future-improvements)
- [Author and license](#author-and-license)
- [FAQ](FAQ.md)

## Screenshots

Browse your media:
Expand All @@ -45,6 +57,7 @@ Multi-touch pitch to zoom images:
* Thumbnail support for images and videos, primary by reading of EXIF thumbnail if it exist, otherwise thumbnails will be created and stored in a thumbnail cache. Video thumbnails requires [ffmpeg](https://www.ffmpeg.org/) to be installed
* Automatic rotation JPEG images when needed (based on EXIF information)
* Generate thumbnails on the fly, on start-up and/or when new files are added to the media directory
* **NEW!** Automatically resize images to reduce network bandwidth and get a smoother navigation at client
* Optional authentication with username and password

## Download and install Linux
Expand Down Expand Up @@ -89,9 +102,9 @@ To uninstall MediaWEB run:
cd ~/mediaweb
sudo sh service.sh uninstall

Also, checkout the [FAQ](FAQ.md).
Also, checkout the [Configuration guide](#configuration-guide) and [FAQ](FAQ.md).

## Download and install on Windows (64bit)
## Download and install on Windows

Download mediaweb_windows_x64_setup.exe [here on GitHub](https://github.com/midstar/mediaweb/releases).

Expand All @@ -102,9 +115,9 @@ service in task manager.

You need to install [ffmpeg](https://www.ffmpeg.org/) separately and put ffmpeg into your PATH to get video thumbnail support.

Also, checkout the [FAQ](FAQ.md).
Also, checkout the [Configuration guide](#configuration-guide) and [FAQ](FAQ.md).

## Build from source (any platform)
## Build from source on any platform

To build from source on any platform you need to:

Expand Down Expand Up @@ -138,6 +151,43 @@ On Linux platforms execute following to install MediaWEB as a service:
sudo sh scripts/service.sh install


## Configuration guide

See [mediaweb.conf](configs/mediaweb.conf) for the available configuration parameters.

The most important configuration parameter is *mediapath* which points out the
directory of your media.

Your might also want to change the *port* configuration parameter.

### Increase performance with preview / resized images

By default the server will provide the full images to the client (WEB browser).
This is generally not an issue if you view your images over your home network, but
over Internet or a mobile network it might take very long time to load the images.
Also, since the images are large, the user interface might feel slow and unresponsive
particulary in mobile web browsers.

To fix these issues, at the cost of more caching storage space, MediaWEB can reduce the
size / resolution and put the resized images in cache. The resizing procedure will
take quite much time, especially for SBCs. Therefore you should configure MediaWEB
to generate the previews at startup and when new files are added to your media
directory:

enablethumbcache = on
genthumbsonstartup = on
genthumbsonadd = on
enablepreview = on
genpreviewonstartup = on
genpreviewonadd = on

Count with ~300 - 800 KB per image, so you need to secure that the cache folder pointed
out with the *cachepath* has enough disk space.

Also, if you have many images and are running on an SBC it might take very, very long
time the first time the images are resized. Count with several days.


## Future improvements

* Add support for TLS/SSL
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ platform: x64
# Do not build on tags (GitHub and BitBucket)
skip_tags: true

version: 1.0.1.{build}
version: 1.1.0.{build}

stack: go 1.11

Expand Down
60 changes: 54 additions & 6 deletions configs/mediaweb.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,69 @@ port = 9834
# mediapath = c:\users\fobar\pictures
mediapath = pictures

# Thumb cache path is by default your operating systems
# temp folder + mediaweb. Uncomment below to set to
# another location. Not used if enablethumbcache = off.
# thumbpath = tmpcache
# Cache path is by default your operating systems
# temp folder + mediaweb. Cache path is where
# thumbnails and preview images are stored.
#
# For example:
# mediapath = /home/fobar/cache/mediaweb
# mediapath = c:\users\fobar\cache\mediaweb
#cachepath = tmpcache

# Thumb cache is by default on. Uncomment below to
# disable thumb cache
#enablethumbcache = off

# Generate thumbs on startup is by default off. Uncomment
# below to generate thumbs every time Media WEB startup.
#genthumbsonstartup = on

# Watch media path for updates is by default on.
# Uncomment below to don't generate new thumbs for files
# that are added in the media path
#genthumbsonadd = off

# Auto rotate of JPEG is by default on. Uncomment below
# to disable auto rotate of JPEG.
#autorotate = off

# Logging is by default output on stderr.
logfile = mediaweb.log

# Resize images before providing them to the client. The
# resized images are cached in the same location as the
# thumbnails.
#
# The advantages are:
# 1. Lower network bandwith required
# 2. Smoother navigation at the client. Particular if
# browsing the images using a mobile client.
#
# Disadvantages are:
# 1. Slower response time to view the image first time
# since resizing image might take several seconds.
# 2. Increased cache storage required.
#
# Previews are default off.
#enablepreview = on

# Max size of preview images in pixels. The image will
# be resized so that width and hight is not larger than
# this value.
#previewmaxside = 1280

# Generate preview images on startup is by default off. Uncomment
# below to generate preview every time Media WEB startup.
#
# Warning! A lot of cache space might be required
#genpreviewonstartup = on

# Watch media path for updates is by default on.
# Uncomment below to don't generate new image previews for
# files that are added in the media path
#genpreviewonadd = off

# Logging is by default output on stderr. Uncomment
# below to log to a file.
#logfile = mediaweb.log

# Logging level is by default info. Available levels
# are trace, debug, info, warn, error and panic.
Expand Down
6 changes: 4 additions & 2 deletions main_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ func mainCommon() *WebAPI {
llog.Info("Build time: %s", applicationBuildTime)
llog.Info("Git hash: %s", applicationGitHash)
box := rice.MustFindBox("templates")
media := createMedia(box, s.mediaPath, s.thumbPath,
s.enableThumbCache, s.genThumbsOnStartup, s.genThumbsOnAdd, s.autoRotate)
media := createMedia(box, s.mediaPath, s.cachePath,
s.enableThumbCache, s.genThumbsOnStartup,
s.genThumbsOnAdd, s.autoRotate, s.enablePreview, s.previewMaxSide,
s.genPreviewOnStartup, s.genPreviewOnAdd)
webAPI := CreateWebAPI(s.port, "templates", media, box, s.userName, s.password)
return webAPI
}
Loading

0 comments on commit a992216

Please sign in to comment.