Skip to content

Commit

Permalink
Fix webp support
Browse files Browse the repository at this point in the history
  • Loading branch information
zozlak committed Sep 19, 2024
1 parent b779e24 commit ce37dc1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,13 @@ RUN cd /opt && \
cat /root/ArcheResolver.py >> /opt/loris/loris/resolver.py && \
mv /root/loris.conf /opt/loris/loris/data/loris.conf && \
apt-get remove -y python3-chardet && \
# patch loris so it accepts all formats supported by the pillow package
sed -i -e 's/elif self.src_format in .*/elif self.src_format in Image.registered_extensions():/' loris/img_info.py &&\
pip3 install . && \
python3 /opt/loris/bin/setup_directories.py && \
mv /root/restrictedAccess.png /opt/loris/restrictedAccess.png
# ARCHE-specific stuff
mv /root/restrictedAccess.png /opt/loris/restrictedAccess.png && \
mkdir /tmp/static && chown www-data:www-data /tmp/static

WORKDIR /opt/loris
VOLUME /var/log/loris /var/cache/loris
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ Important files
* `root/loris.conf`, especially the section with the resolver settings
* `root/loris-cron` - defines the cache pruning frequency and allowed cache size

## Adjustments made

* Own [resolver](https://github.com/loris-imageserver/loris/blob/development/doc/resolver.md) combining
`SimpleFSResolver` serving data from `/tmp/static` with `SimpleHTTPResolver` serving data from
ARCHE instances and capable of accessing data from a single selected ARCHE instance locally.
* Loris configuration tuned to support WEBP and GIF as source formats and WEBP as an output format.

## Debugging

* Apache/WSGI logs are in `/var/log/loris/`
* After the deployment sources used by the WSGI module are in `/usr/local/lib/python3.8/dist-packages/loris`.
After editing the Apache should be restarted with `supervisorctl restart apache2`
* Especially the `loris.conf` is in `/usr/local/lib/python3.8/dist-packages/loris/data/loris.conf`
* After editing the Apache should be restarted with `supervisorctl restart apache2`
* For experimenting with file formats support:
* create `/tmp/static/` directory owned by the `www-data:www-data` user/group
* upload images into it
Expand Down
2 changes: 1 addition & 1 deletion root/loris.conf
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ cache_dp = '/var/cache/loris' # rwx

[transforms]
dither_bitonal_images = False
target_formats = ['jpg','png','gif','webp', 'gif']
target_formats = ['jpg','png','gif','webp']

[[png]]
impl = 'PNG_Transformer'
Expand Down

0 comments on commit ce37dc1

Please sign in to comment.