Fixing previews.
This commit is contained in:
parent
a76b17de27
commit
19bfe3b9b4
@ -11,6 +11,7 @@ use Const::Fast;
|
|||||||
use Mojo::DOM;
|
use Mojo::DOM;
|
||||||
use Path::Tiny;
|
use Path::Tiny;
|
||||||
|
|
||||||
|
use OwlcodeTech;
|
||||||
use OwlcodeTech::Preview;
|
use OwlcodeTech::Preview;
|
||||||
|
|
||||||
const my $CURRENT_FILE => __FILE__;
|
const my $CURRENT_FILE => __FILE__;
|
||||||
@ -158,8 +159,9 @@ sub _AvoidGrandChildCategories ( $self, $categories ) {
|
|||||||
sub PreviewOg ( $self, $category ) {
|
sub PreviewOg ( $self, $category ) {
|
||||||
my $title = $category->{title};
|
my $title = $category->{title};
|
||||||
my $description = $category->{description};
|
my $description = $category->{description};
|
||||||
my $site_name = $self->config('site_name');
|
my $image = $category->{image};
|
||||||
return OwlcodeTech::Preview->Generate( $title, $description, undef,
|
my $site_name = OwlcodeTech->new->config('site_name');
|
||||||
|
return OwlcodeTech::Preview->Generate( $title, $description, $image,
|
||||||
$site_name );
|
$site_name );
|
||||||
}
|
}
|
||||||
1;
|
1;
|
||||||
|
@ -17,7 +17,7 @@ use MIME::Base64;
|
|||||||
const my $CURRENT_FILE => __FILE__;
|
const my $CURRENT_FILE => __FILE__;
|
||||||
const my $ROOT_PROJECT => path($CURRENT_FILE)->parent->parent->parent;
|
const my $ROOT_PROJECT => path($CURRENT_FILE)->parent->parent->parent;
|
||||||
const my $PUBLIC_DIR => $ROOT_PROJECT->child('public');
|
const my $PUBLIC_DIR => $ROOT_PROJECT->child('public');
|
||||||
const my $BURGUILLOS_LOGO => $PUBLIC_DIR->child('img/burguillos.webp');
|
const my $OWLCODE_LOGO => $PUBLIC_DIR->child('img/owlcode_tech.webp');
|
||||||
const my $SVG_WIDTH => 1200;
|
const my $SVG_WIDTH => 1200;
|
||||||
const my $SVG_HEIGHT => 627;
|
const my $SVG_HEIGHT => 627;
|
||||||
const my $SVG_EMBEDDED_IMAGE_MAX_WIDTH => 1000;
|
const my $SVG_EMBEDDED_IMAGE_MAX_WIDTH => 1000;
|
||||||
@ -26,6 +26,7 @@ const my $SVG_EMBEDDED_IMAGE_MAX_HEIGHT => 200;
|
|||||||
sub Generate ( $self, $title, $content, $image_file, $site_name ) {
|
sub Generate ( $self, $title, $content, $image_file, $site_name ) {
|
||||||
my $dom = Mojo::DOM->new($content);
|
my $dom = Mojo::DOM->new($content);
|
||||||
$content = $dom->all_text;
|
$content = $dom->all_text;
|
||||||
|
$title = Mojo::DOM->new('<div>'.$title.'</div>')->all_text;
|
||||||
|
|
||||||
my $svg =
|
my $svg =
|
||||||
$self->_GenerateSVGPreview( $title,
|
$self->_GenerateSVGPreview( $title,
|
||||||
@ -62,16 +63,14 @@ sub _GenerateSVGPreviewHeaderBar ( $self, $svg, $group, $site_name ) {
|
|||||||
style => { fill => '#F8F8FF' }
|
style => { fill => '#F8F8FF' }
|
||||||
);
|
);
|
||||||
|
|
||||||
my $burguillos_logo_png = path( $self->_ToPng($BURGUILLOS_LOGO) );
|
my $owlcode_logo_png = path( $self->_ToPng($OWLCODE_LOGO) );
|
||||||
say $burguillos_logo_png;
|
|
||||||
say '' . $burguillos_logo_png;
|
|
||||||
$group->image(
|
$group->image(
|
||||||
x => 10,
|
x => 10,
|
||||||
y => 5,
|
y => 5,
|
||||||
width => 40,
|
width => 40,
|
||||||
height => 40,
|
height => 40,
|
||||||
-href => 'data:image/png;base64,'
|
-href => 'data:image/png;base64,'
|
||||||
. encode_base64( $burguillos_logo_png->slurp )
|
. encode_base64( $owlcode_logo_png->slurp )
|
||||||
);
|
);
|
||||||
$group->text(
|
$group->text(
|
||||||
x => 60,
|
x => 60,
|
||||||
|
Loading…
Reference in New Issue
Block a user