From 49c56fdaf9b1bc86ab7d4933f77202878df69724 Mon Sep 17 00:00:00 2001 From: vnmedeiros Date: Fri, 9 Jul 2021 17:33:31 -0300 Subject: [PATCH] feat: change scale of blurhash --- src/classes/class-tainacan-media.php | 6 +++--- src/classes/repositories/class-tainacan-repository.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/classes/class-tainacan-media.php b/src/classes/class-tainacan-media.php index 2c4ce01b2..f709b311c 100644 --- a/src/classes/class-tainacan-media.php +++ b/src/classes/class-tainacan-media.php @@ -401,7 +401,7 @@ class Media { return $this->get_default_image_blurhash(); } - $max_width = 45; + $max_width = 90; if( $width > $max_width ) { $image = imagescale($image, $max_width); $width = imagesx($image); @@ -418,8 +418,8 @@ class Media { } $pixels[] = $row; } - $components_x = 4; - $components_y = 3; + $components_x = 5; + $components_y = 4; $blurhash = \kornrunner\Blurhash\Blurhash::encode($pixels, $components_x, $components_y); return $blurhash; } diff --git a/src/classes/repositories/class-tainacan-repository.php b/src/classes/repositories/class-tainacan-repository.php index 6b0f53202..24282b920 100644 --- a/src/classes/repositories/class-tainacan-repository.php +++ b/src/classes/repositories/class-tainacan-repository.php @@ -864,7 +864,7 @@ abstract class Repository { $thumbnail_id = $obj->get__thumbnail_id(); if($thumbnail_id) { - $tmp_src = wp_get_attachment_image_src( $thumbnail_id, 'tainacan-small' ); + $tmp_src = wp_get_attachment_image_src( $thumbnail_id, 'tainacan-medium' ); $file_name = get_attached_file( $thumbnail_id ); $blurhash = \Tainacan\Media::get_instance()->get_image_blurhash($file_name, $tmp_src[1], $tmp_src[2]); $attachment_metadata = \wp_get_attachment_metadata($thumbnail_id);