You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
include_once(PATH_LIBRARY.'/vendors/simplehtmldom/simple_html_dom.php');
if ($PageNumber == 1) {
$this->description(sliceParagraph(Gdn_Format::plainText($this->Discussion->Body, $this->Discussion->Format), 160));
// Add images to head for open graph
$Dom = str_get_html(Gdn_Format::to($this->Discussion->Body, $this->Discussion->Format));
} else {
$this->Data['Title'] .= sprintf(t(' - Page %s'), PageNumber($this->Offset, $Limit));
$FirstComment = $this->data('Comments')->firstRow();
$FirstBody = val('Body', $FirstComment);
$FirstFormat = val('Format', $FirstComment);
$this->description(sliceParagraph(Gdn_Format::plainText($FirstBody, $FirstFormat), 160));
// Add images to head for open graph
$Dom = str_get_html(Gdn_Format::to($FirstBody, $FirstFormat));
}
if ($Dom) {
foreach ($Dom->find('img') as $img) {
if (isset($img->src)) {
$this->image($img->src);
}
}
}
So we're opening the DOM on EVERY load to find images in the OP. Presumably it'd make a helluva lot more sense to store this open graph image information as a separate DB field to avoid doing this. I'd suggest the existing Gdn_Discussion.Attributes.
The text was updated successfully, but these errors were encountered:
DiscussionController::index()
has this gem:So we're opening the DOM on EVERY load to find images in the OP. Presumably it'd make a helluva lot more sense to store this open graph image information as a separate DB field to avoid doing this. I'd suggest the existing
Gdn_Discussion.Attributes
.The text was updated successfully, but these errors were encountered: