Attached pictures in OStatus posts are now displayed

This commit is contained in:
Michael 2017-06-06 17:55:14 +00:00
parent 7fb4b1be12
commit 910cca0629

View file

@ -1397,9 +1397,9 @@ function prepare_body(&$item,$attach = false, $preview = false) {
));
}
$filetype = strtolower(substr( $mime, 0, strpos($mime,'/') ));
$filetype = strtolower(substr($mime, 0, strpos($mime,'/')));
if($filetype) {
$filesubtype = strtolower(substr( $mime, strpos($mime,'/') + 1 ));
$filesubtype = strtolower(substr($mime, strpos($mime,'/') + 1));
$filesubtype = str_replace('.', '-', $filesubtype);
}
else {
@ -1407,23 +1407,15 @@ function prepare_body(&$item,$attach = false, $preview = false) {
$filesubtype = 'unkn';
}
$icon = '<div class="attachtype icon s22 type-' . $filetype . ' subtype-' . $filesubtype . '"></div>';
/*$icontype = strtolower(substr($mtch[3],0,strpos($mtch[3],'/')));
switch($icontype) {
case 'video':
case 'audio':
case 'image':
case 'text':
$icon = '<div class="attachtype icon s22 type-' . $icontype . '"></div>';
break;
default:
$icon = '<div class="attachtype icon s22 type-unkn"></div>';
break;
}*/
$title = ((strlen(trim($mtch[4]))) ? escape_tags(trim($mtch[4])) : escape_tags($mtch[1]));
$title .= ' ' . $mtch[2] . ' ' . t('bytes');
if (($filetype == 'image') AND ($item['network'] == NETWORK_OSTATUS)) {
$icon = '<img src="'.$the_url.'" alt="" title="'.$title.'">';
} else {
$icon = '<div class="attachtype icon s22 type-' . $filetype . ' subtype-' . $filesubtype . '"></div>';
}
$as .= '<a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attachlink" target="_blank" >' . $icon . '</a>';
}
}