From ea9748cd3e847ba9d2863bd3d4d7f5947878ec46 Mon Sep 17 00:00:00 2001 From: vnmedeiros Date: Thu, 17 Dec 2020 17:08:17 -0300 Subject: [PATCH] fix: test if imagecreatefromstring is supported in PHP build --- src/classes/entities/class-tainacan-item.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/classes/entities/class-tainacan-item.php b/src/classes/entities/class-tainacan-item.php index 17e179b35..2886a1627 100644 --- a/src/classes/entities/class-tainacan-item.php +++ b/src/classes/entities/class-tainacan-item.php @@ -144,8 +144,10 @@ class Item extends Entity { } private function get_iamge_blurhash($file_path, $width, $height) { - $image = imagecreatefromstring(file_get_contents($file_path)); - if($image == false) + if (!$image = @imagecreatefromstring(file_get_contents($file_path))) { + return "L2OzSs00j[_3D%xuWBt700_3IU%M"; + } + if($image == false) return ''; $max_width = 45;