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
This commit is contained in:
Daniel Hensby 2014-04-24 09:10:24 +01:00
parent 346990c877
commit 0e58e97eea

View File

@ -267,7 +267,10 @@ class Oembed_Result extends ViewableData {
if(!$data) { if(!$data) {
// if the response is no valid JSON we might have received a binary stream to an image // if the response is no valid JSON we might have received a binary stream to an image
$data = array(); $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) { if($image !== FALSE) {
preg_match("/^(http:\/\/)?([^\/]+)/i", $this->url, $matches); preg_match("/^(http:\/\/)?([^\/]+)/i", $this->url, $matches);
$protocoll = $matches[1]; $protocoll = $matches[1];