From 0e58e97eea67afa98cc20a0947cb12b083ab2525 Mon Sep 17 00:00:00 2001 From: Daniel Hensby Date: Thu, 24 Apr 2014 09:10:24 +0100 Subject: [PATCH] Oembed warning if GD function is missing Silencing errors from a function is terrible so I've stopped that. I've also added detection for if `imagecreatefromstring` is a declared function and a useful error is thrown if not --- oembed/Oembed.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/oembed/Oembed.php b/oembed/Oembed.php index 3a2c067c4..035d23b84 100644 --- a/oembed/Oembed.php +++ b/oembed/Oembed.php @@ -267,7 +267,10 @@ class Oembed_Result extends ViewableData { if(!$data) { // if the response is no valid JSON we might have received a binary stream to an image $data = array(); - $image = @imagecreatefromstring($body); + if (!function_exists('imagecreatefromstring')) { + throw new LogicException('imagecreatefromstring function does not exist - Please make sure GD is installed'); + } + $image = imagecreatefromstring($body); if($image !== FALSE) { preg_match("/^(http:\/\/)?([^\/]+)/i", $this->url, $matches); $protocoll = $matches[1];