]> git.mxchange.org Git - friendica.git/commitdiff
Attached pictures in OStatus posts are now displayed
authorMichael <heluecht@pirati.ca>
Tue, 6 Jun 2017 17:55:14 +0000 (17:55 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 6 Jun 2017 17:55:14 +0000 (17:55 +0000)
include/text.php

index c9babba940f8f06e31770f638407bb5a3839b169..2a8b84c65f580acdc87cf712dcd8818dff289ed2 100644 (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>';
                                }
                        }