]> git.mxchange.org Git - friendica.git/commitdiff
png support for embedded private photos
authorfriendica <info@friendica.com>
Thu, 7 Jun 2012 23:02:56 +0000 (16:02 -0700)
committerfriendica <info@friendica.com>
Thu, 7 Jun 2012 23:02:56 +0000 (16:02 -0700)
include/items.php
mod/msearch.php
mod/photo.php

index 15c043e922080adc8137621113a471d92dde1d12..fc6819738e0583db0c8e391361870153854933a3 100755 (executable)
@@ -2952,7 +2952,7 @@ function fix_private_photos($s,$uid, $item = null, $cid = 0) {
                if(stristr($image , $site . '/photo/')) {
                        $replace = false;
                        $i = basename($image);
-                       $i = str_replace('.jpg','',$i);
+                       $i = str_replace(array('.jpg','.png'),array('',''),$i);
                        $x = strpos($i,'-');
                        if($x) {
                                $res = substr($i,$x+1);
@@ -2994,7 +2994,7 @@ function fix_private_photos($s,$uid, $item = null, $cid = 0) {
                                        }
                                        if($replace) {
                                                logger('fix_private_photos: replacing photo', LOGGER_DEBUG);
-                                               $s = str_replace($image, 'data:image/jpg;base64,' . base64_encode($r[0]['data']), $s);
+                                               $s = str_replace($image, 'data:' . $r[0]['type'] . ';base64,' . base64_encode($r[0]['data']), $s);
                                                logger('fix_private_photos: replaced: ' . $s, LOGGER_DATA);
                                        }
                                }
index 94def7d89c8d238954dcfd843de86d6a92369bd3..89de5b70576f354653ad4daf8645d5aa5b843876 100644 (file)
@@ -28,7 +28,7 @@ function msearch_post(&$a) {
                        $results[] = array(
                                'name' => $rr['name'], 
                                'url' => $a->get_baseurl() . '/profile/' . $rr['nickname'], 
-                               'photo' => $a->get_baseurl() . '/photo/avatar/' . $rr['uid'] . 'jpg',
+                               'photo' => $a->get_baseurl() . '/photo/avatar/' . $rr['uid'] . '.jpg',
                                'tags' => str_replace(array(',','  '),array(' ',' '),$rr['pub_keywords'])
                        );
        }
index e8e74cfde192c08f56770a90478dbddb24959431..dee483d835bbda6479376d21a0c5a603f9cf29b1 100644 (file)
@@ -76,7 +76,7 @@ function photo_init(&$a) {
                                break;
                }
 
-               $uid = str_replace('.jpg', '', $person);
+               $uid = str_replace(array('.jpg','.png'),array('',''), $person);
 
                $r = q("SELECT * FROM `photo` WHERE `scale` = %d AND `uid` = %d AND `profile` = 1 LIMIT 1",
                        intval($resolution),