Removed big clip and replaced with smaller inline one next to each URL (in a notice) that's actually an attachment. Overlay (popup) on click.
This commit is contained in:
11
lib/util.php
11
lib/util.php
@@ -496,6 +496,17 @@ function common_linkify($url) {
|
||||
}
|
||||
|
||||
$attrs = array('href' => $longurl, 'rel' => 'external');
|
||||
|
||||
// if this URL is an attachment, then we set class='attachment' and id='attahcment-ID'
|
||||
// where ID is the id of the attachment for the given URL.
|
||||
$query = "select file_oembed.file_id as file_id from file join file_oembed on file.id = file_oembed.file_id where file.url='$longurl'";
|
||||
$file = new File;
|
||||
$file->query($query);
|
||||
$file->fetch();
|
||||
if (!empty($file->file_id)) {
|
||||
$attrs['class'] = 'attachment';
|
||||
$attrs['id'] = "attachment-{$file->file_id}";
|
||||
}
|
||||
return XMLStringer::estring('a', $attrs, $display);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user