Browse Source

Merge branch 'master' of github.com:edhelas/movim

pull/16/head
edhelas 10 years ago
parent
commit
9f5028bc9e
  1. 20
      app/helpers/StringHelper.php

20
app/helpers/StringHelper.php

@ -62,14 +62,18 @@ function prepareString($string, $large = false, $preview = false) {
if(!in_array(substr($match[0], 0, 1), array('>', '"', '\''))) {
$content = $match[0];
if($preview) {
$embed = Embed\Embed::create($match[0]);
if($embed->type == 'photo'
&& $embed->images[0]['width'] <= 1024
&& $embed->images[0]['height'] <= 1024) {
$content = '<img src="'.$match[0].'"/>';
} elseif($embed->type == 'link') {
$content .= ' - '. $embed->title . ' - ' . $embed->providerName;
if($preview) {
try {
$embed = Embed\Embed::create($match[0]);
if($embed->type == 'photo'
&& $embed->images[0]['width'] <= 1024
&& $embed->images[0]['height'] <= 1024) {
$content = '<img src="'.$match[0].'"/>';
} elseif($embed->type == 'link') {
$content .= ' - '. $embed->title . ' - ' . $embed->providerName;
}
} catch(Exception $e) {
error_log($e->getMessage());
}
}

Loading…
Cancel
Save