Skip to content

Commit

Permalink
Oembed warning if GD function is missing
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dhensby committed Apr 24, 2014
1 parent 346990c commit 0e58e97
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion oembed/Oembed.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,10 @@ protected function loadData() {
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];
Expand Down

0 comments on commit 0e58e97

Please sign in to comment.