Ensuring jpeg is never used.

This commit is contained in:
sergiotarxz 2023-05-03 18:45:51 +02:00
parent 1d838f0e5d
commit 02682eb20b
1 changed files with 9 additions and 0 deletions

View File

@ -259,6 +259,7 @@ sub _AttachImageSVG {
system qw/file --mime-type/, $image;
};
my ($format) = $output =~ /(\S+)$/;
say $format;
$svg->image(
x => $x,
y => $y,
@ -274,6 +275,14 @@ sub _GenerateSVGPostPreview {
my $title = shift;
my $content = shift;
my $image = shift;
if ($image =~ /\.jpe?g$/) {
my $new_image = $image =~ s/\.jpe?g$/.generated.png/r;
my $dir = 'public';
if (!-e $new_image) {
system 'convert', "$dir/$image", "$dir/$new_image";
}
$image = $new_image;
}
my @content = @$content;
my $svg = SVG->new( width => $SVG_WIDTH, height => $SVG_HEIGHT );
$svg->rect(