SVG Server Docker Fix

This commit is contained in:
Hydrus Network Developer 2023-07-19 16:38:23 -05:00
parent 27e1bb5b85
commit 4333baa4b2
No known key found for this signature in database
GPG Key ID: 76249F053212133C
3 changed files with 26 additions and 7 deletions

View File

@ -11,7 +11,7 @@ title: Changelog
### misc
* thanks to a user, we now have Krita (.kra, .krz) support! it even pulls thumbnails]
* thanks to a user, we now have Krita (.kra, .krz) support! it even pulls thumbnails!
* thanks to another user, we now have SVG (.svg) support! it even generates thumbnails!
* I think I fixed a comparison statement calculator divide-by-zero error in the duplicate filter when you compare a file with a resolution with a file without one

View File

@ -38,7 +38,7 @@
<h2 id="version_535"><a href="#version_535">version 535</a></h2>
<ul>
<li><h3>misc</h3></li>
<li>thanks to a user, we now have Krita (.kra, .krz) support! it even pulls thumbnails]</li>
<li>thanks to a user, we now have Krita (.kra, .krz) support! it even pulls thumbnails!</li>
<li>thanks to another user, we now have SVG (.svg) support! it even generates thumbnails!</li>
<li>I think I fixed a comparison statement calculator divide-by-zero error in the duplicate filter when you compare a file with a resolution with a file without one</li>
<li><h3>petitions overview</h3></li>

View File

@ -5,7 +5,18 @@ import struct
from hydrus.core import HydrusAudioHandling
from hydrus.core import HydrusClipHandling
from hydrus.core import HydrusKritaHandling
from hydrus.core import HydrusSVGHandling
try:
from hydrus.core import HydrusSVGHandling
SVG_OK = True
except:
SVG_OK = False
from hydrus.core import HydrusConstants as HC
from hydrus.core import HydrusData
from hydrus.core import HydrusDocumentHandling
@ -184,6 +195,11 @@ def GenerateThumbnailBytes( path, target_resolution, mime, duration, num_frames,
try:
if not SVG_OK:
raise Exception( 'No SVG thumbs' )
thumbnail_bytes = HydrusSVGHandling.GenerateThumbnailBytesFromSVGPath( path, target_resolution, clip_rect = clip_rect )
except Exception as e:
@ -360,11 +376,14 @@ def GetFileInfo( path, mime = None, ok_to_look_for_hydrus_updates = False ):
elif mime == HC.APPLICATION_KRITA:
( width, height ) = HydrusKritaHandling.GetKraProperties( path )
elif mime == HC.IMAGE_SVG:
( width, height ) = HydrusSVGHandling.GetSVGResolution( path )
if SVG_OK:
( width, height ) = HydrusSVGHandling.GetSVGResolution( path )
elif mime == HC.APPLICATION_FLASH:
( ( width, height ), duration, num_frames ) = HydrusFlashHandling.GetFlashProperties( path )