redmine_apijs 6.9.4 → 6.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/assets/javascripts/apijs.min.js +2 -2
- data/assets/javascripts/apijs.min.js.map +1 -1
- data/assets/stylesheets/apijs-print.min.css +2 -2
- data/assets/stylesheets/apijs-print.min.css.map +1 -1
- data/assets/stylesheets/apijs-redmine-rtl.min.css +1 -1
- data/assets/stylesheets/apijs-redmine-rtl.min.css.map +1 -1
- data/assets/stylesheets/apijs-redmine.css +3 -3
- data/assets/stylesheets/apijs-redmine.min.css +1 -1
- data/assets/stylesheets/apijs-redmine.min.css.map +1 -1
- data/assets/stylesheets/apijs-screen-rtl.min.css +2 -2
- data/assets/stylesheets/apijs-screen-rtl.min.css.map +1 -1
- data/assets/stylesheets/apijs-screen.min.css +2 -2
- data/assets/stylesheets/apijs-screen.min.css.map +1 -1
- data/init.rb +1 -1
- data/lib/image.py +25 -17
- data/redmine_apijs.gemspec +1 -1
- metadata +2 -2
data/lib/image.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/python3
|
2
2
|
# -*- coding: utf8 -*-
|
3
3
|
# Created J/26/12/2013
|
4
|
-
# Updated
|
4
|
+
# Updated J/05/10/2023
|
5
5
|
#
|
6
6
|
# Copyright 2008-2023 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
|
7
7
|
# Copyright 2020-2023 | Fabrice Creuzot <fabrice~cellublue~com>
|
@@ -26,11 +26,11 @@ try:
|
|
26
26
|
quality = int(sys.argv[5]) if len(sys.argv) >= 6 else 0
|
27
27
|
fixed = len(sys.argv) >= 7 and sys.argv[6] == 'fixed'
|
28
28
|
except:
|
29
|
-
print(
|
30
|
-
print(
|
31
|
-
print(
|
32
|
-
print(
|
33
|
-
print(
|
29
|
+
print('Usage: image.py source_file destination_file width_px height_px [quality=0:auto..100 or 0:auto..9 for png] [fixed]')
|
30
|
+
print('source: all supported format by python-pil (including animated gif/png/webp),')
|
31
|
+
print(' or all supported format by ffmpegthumbnailer,')
|
32
|
+
print(' or svg')
|
33
|
+
print('destination: jpg,gif,png,webp or svg')
|
34
34
|
exit(-1)
|
35
35
|
|
36
36
|
# https://stackoverflow.com/a/273227/2980105
|
@@ -254,14 +254,14 @@ def saveJpg(dest, fileout, quality):
|
|
254
254
|
#try:
|
255
255
|
# import pyguetzli
|
256
256
|
# filefinal = pyguetzli.process_pil_image(dest.convert('RGB'), quality)
|
257
|
-
# output = open(fileout,
|
257
|
+
# output = open(fileout, 'wb')
|
258
258
|
# output.write(filefinal)
|
259
259
|
#except ImportError:
|
260
260
|
dest.convert('RGB').save(fileout, 'JPEG', optimize=True, subsampling=0, quality=quality)
|
261
261
|
|
262
262
|
|
263
263
|
# python-scour
|
264
|
-
if
|
264
|
+
if '.svg' in fileout:
|
265
265
|
from scour.scour import sanitizeOptions, start
|
266
266
|
options = sanitizeOptions()
|
267
267
|
options.strip_xml_prolog = True # --strip-xml-prolog
|
@@ -274,7 +274,7 @@ if ".svg" in fileout:
|
|
274
274
|
else:
|
275
275
|
from PIL import Image, ImageSequence
|
276
276
|
|
277
|
-
if
|
277
|
+
if '.ogv' in filein or '.webm' in filein or '.mp4' in filein:
|
278
278
|
# from video
|
279
279
|
source = videoToImage(filein, fileout, size)
|
280
280
|
imgext = 'VIDEO'
|
@@ -285,19 +285,27 @@ else:
|
|
285
285
|
size = calcSize(source, size)
|
286
286
|
|
287
287
|
# filein = fileout = /tmp/phpA5kbkc when replace tmp image with re-sampled copy to exclude images with malicious data
|
288
|
-
|
288
|
+
# @todo for animated GIF to animated GIF (or PNG), sadly, result file is not optimized, the idea is to reprocess the file to not replace each frames by another one
|
289
|
+
# for my test image, https://github.com/kohler/gifsicle, don't do it, but https://kraken.io/web-interface do it
|
290
|
+
if imgext == 'GIF' and (same or '.gif' in fileout):
|
289
291
|
dest = resizeAnimatedGif(source, size, fixed)
|
290
292
|
saveGif(dest, fileout, quality)
|
291
|
-
elif imgext == 'GIF' and (
|
293
|
+
elif imgext == 'GIF' and ( '.png' in fileout): # @todo
|
294
|
+
dest = resizeAnimatedGif(source, size, fixed)
|
295
|
+
savePng(dest, fileout, quality)
|
296
|
+
elif imgext == 'GIF' and ( '.webp' in fileout):
|
292
297
|
dest = resizeAnimatedGif(source, size, fixed)
|
293
298
|
saveWebp(dest, fileout, quality)
|
294
|
-
elif imgext == 'PNG' and (same or
|
299
|
+
elif imgext == 'PNG' and (same or '.png' in fileout):
|
295
300
|
dest = resizeAnimatedPng(source, size, fixed)
|
296
301
|
savePng(dest, fileout, quality)
|
297
|
-
elif imgext == 'PNG' and (
|
302
|
+
elif imgext == 'PNG' and ( '.gif' in fileout):
|
303
|
+
dest = resizeAnimatedPng(source, size, fixed)
|
304
|
+
saveGif(dest, fileout, quality)
|
305
|
+
elif imgext == 'PNG' and ( '.webp' in fileout):
|
298
306
|
dest = resizeAnimatedPng(source, size, fixed)
|
299
307
|
saveWebp(dest, fileout, quality)
|
300
|
-
elif imgext == 'WEBP' and (same or
|
308
|
+
elif imgext == 'WEBP' and (same or '.webp' in fileout):
|
301
309
|
dest = resizeAnimatedWebp(source, size, fixed)
|
302
310
|
saveWebp(dest, fileout, quality)
|
303
311
|
else:
|
@@ -340,11 +348,11 @@ else:
|
|
340
348
|
if hasTransparency(source) is False:
|
341
349
|
dest = dest.convert('RGB')
|
342
350
|
|
343
|
-
if
|
351
|
+
if '.gif' in fileout or (same and imgext == 'GIF'):
|
344
352
|
saveGif(dest, fileout, quality)
|
345
|
-
elif
|
353
|
+
elif '.png' in fileout or (same and imgext == 'PNG'):
|
346
354
|
savePng(dest, fileout, quality)
|
347
|
-
elif
|
355
|
+
elif '.webp' in fileout or (same and imgext == 'WEBP'):
|
348
356
|
saveWebp(dest, fileout, quality)
|
349
357
|
else:
|
350
358
|
saveJpg(dest, fileout, quality)
|
data/redmine_apijs.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = 'redmine_apijs'
|
4
|
-
s.version = '6.9.
|
4
|
+
s.version = '6.9.5'
|
5
5
|
s.summary = 'Redmine Apijs plugin'
|
6
6
|
s.description = 'Integrate the apijs JavaScript library into Redmine. Provides a gallery for image and video attachments. Gem for Redmine 3.0+ (tested with 3.0..5.0), for Redmine 4.1+ read https://redmine.org/issues/31110#note-8'
|
7
7
|
s.homepage = 'https://github.com/luigifab/redmine-apijs'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redmine_apijs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.9.
|
4
|
+
version: 6.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabrice Creuzot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Integrate the apijs JavaScript library into Redmine. Provides a gallery
|
14
14
|
for image and video attachments. Gem for Redmine 3.0+ (tested with 3.0..5.0), for
|