Fix for older photos not being embedded by the embedphotos tool.
This commit is contained in:
parent
e128ff4e8f
commit
125713e938
@ -39,7 +39,7 @@ class Embedphotos extends \Zotlabs\Web\Controller {
|
|||||||
json_return_and_die(array('errormsg' => 'Error retrieving link ' . $href, 'status' => false));
|
json_return_and_die(array('errormsg' => 'Error retrieving link ' . $href, 'status' => false));
|
||||||
}
|
}
|
||||||
$resource_id = array_pop(explode("/", $href));
|
$resource_id = array_pop(explode("/", $href));
|
||||||
$r = q("SELECT obj from item where resource_type = 'photo' and resource_id = '%s' limit 1",
|
$r = q("SELECT obj,body from item where resource_type = 'photo' and resource_id = '%s' limit 1",
|
||||||
dbesc($resource_id)
|
dbesc($resource_id)
|
||||||
);
|
);
|
||||||
if(!$r) {
|
if(!$r) {
|
||||||
@ -50,7 +50,9 @@ class Embedphotos extends \Zotlabs\Web\Controller {
|
|||||||
$photolink = $obj['body'];
|
$photolink = $obj['body'];
|
||||||
} elseif (x($obj,'bbcode')) {
|
} elseif (x($obj,'bbcode')) {
|
||||||
$photolink = $obj['bbcode'];
|
$photolink = $obj['bbcode'];
|
||||||
} else {
|
} elseif ($r[0]['body'] !== '') {
|
||||||
|
$photolink = $r[0]['body'];
|
||||||
|
} else {
|
||||||
json_return_and_die(array('errormsg' => 'Error retrieving resource ' . $resource_id, 'status' => false));
|
json_return_and_die(array('errormsg' => 'Error retrieving resource ' . $resource_id, 'status' => false));
|
||||||
}
|
}
|
||||||
json_return_and_die(array('status' => true, 'photolink' => $photolink));
|
json_return_and_die(array('status' => true, 'photolink' => $photolink));
|
||||||
|
Reference in New Issue
Block a user