public function preloadDiscussionMedia($DiscussionID, $CommentIDList)
{
$this->fireEvent('BeforePreloadDiscussionMedia');
$Data = $this->SQL->select('m.*')->from('Media m')->beginWhereGroup()->where('m.ForeignID', $DiscussionID)->where('m.ForeignTable', 'discussion')->endWhereGroup()->orOp()->beginWhereGroup()->whereIn('m.ForeignID', $CommentIDList)->where('m.ForeignTable', 'comment')->endWhereGroup()->get();
// Assign image heights/widths where necessary.
$Data2 = $Data->result();
foreach ($Data2 as &$Row) {
if ($Row->ImageHeight === null || $Row->ImageWidth === null) {
list($Row->ImageWidth, $Row->ImageHeight) = self::getImageSize(MediaModel::pathUploads() . '/' . ltrim($Row->Path, '/'));
$this->SQL->put('Media', array('ImageWidth' => $Row->ImageWidth, 'ImageHeight' => $Row->ImageHeight), array('MediaID' => $Row->MediaID));
}
}
return $Data;
}