feat: change scale of blurhash

This commit is contained in:
vnmedeiros 2021-07-09 17:33:31 -03:00
parent 888882668b
commit 49c56fdaf9
2 changed files with 4 additions and 4 deletions

View File

@ -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;
}

View File

@ -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);