Replacing previews again to png.

This commit is contained in:
sergiotarxz 2023-05-04 00:13:49 +02:00
parent 6109a4f50a
commit 136f23d3be
3 changed files with 4 additions and 4 deletions

View File

@ -36,7 +36,7 @@ sub startup ($self) {
$r->get('/<:category>.rss')->to('Page#category_rss'); $r->get('/<:category>.rss')->to('Page#category_rss');
$r->get('/:category_slug/atributo/:attribute_slug')->to('Attribute#get'); $r->get('/:category_slug/atributo/:attribute_slug')->to('Attribute#get');
$r->get('/:category')->to('Page#category'); $r->get('/:category')->to('Page#category');
$r->get('/posts/<:slug>-preview.webp')->to('Page#get_post_preview'); $r->get('/posts/<:slug>-preview.png')->to('Page#get_post_preview');
$r->get('/posts/:slug')->to('Page#post'); $r->get('/posts/:slug')->to('Page#post');
$r->get('/filtros')->to('Filter#list'); $r->get('/filtros')->to('Filter#list');
$r->get('/filtros/:slug')->to('Filter#get'); $r->get('/filtros/:slug')->to('Filter#get');

View File

@ -119,7 +119,7 @@ sub post {
return; return;
} }
my $current_category = $categories->{ $post->{category} }; my $current_category = $categories->{ $post->{category} };
$self->stash(ogimage => 'https://burguillos.info/posts/'.$post->{slug}.'-preview.webp'); $self->stash(ogimage => 'https://burguillos.info/posts/'.$post->{slug}.'-preview.png');
$self->stash(useragent => $self->req->headers->user_agent); $self->stash(useragent => $self->req->headers->user_agent);
$self->render( post => $post, current_category => $current_category ); $self->render( post => $post, current_category => $current_category );
} }

View File

@ -219,7 +219,7 @@ sub PostPreviewOg {
my $svg = my $svg =
$self->_GenerateSVGPostPreview( $title, \@new_content, $post->{image} ); $self->_GenerateSVGPostPreview( $title, \@new_content, $post->{image} );
my ( $stdout, $stderr ) = capture { my ( $stdout, $stderr ) = capture {
open my $fh, '|-', qw{convert /dev/stdin webp:fd:1}; open my $fh, '|-', qw{convert /dev/stdin png:fd:1};
binmode $fh, 'utf8'; binmode $fh, 'utf8';
print $fh $svg; print $fh $svg;
close $fh; close $fh;
@ -276,7 +276,7 @@ sub _GenerateSVGPostPreview {
my $content = shift; my $content = shift;
my $image = shift; my $image = shift;
if ($image =~ /\.jpe?g$/) { if ($image =~ /\.jpe?g$/) {
my $new_image = $image =~ s/\.jpe?g$/.generated.webp/r; my $new_image = $image =~ s/\.jpe?g$/.generated.png/r;
my $dir = 'public'; my $dir = 'public';
if (!-e $new_image) { if (!-e $new_image) {
system 'convert', "$dir/$image", "$dir/$new_image"; system 'convert', "$dir/$image", "$dir/$new_image";