]> git.mxchange.org Git - friendica.git/blobdiff - mod/profile_photo.php
put profile photo on photos page
[friendica.git] / mod / profile_photo.php
index f77cbfecda829a7493371a1d6ae3f6800da78f84..4de3aaa3e0c255e007d1b7590e9ef9ae3ecd788e 100644 (file)
@@ -155,9 +155,15 @@ function profile_photo_content(&$a) {
                        notice( t('Permission denied.') . EOL );
                        return;
                }
+               $havescale = false;
+               foreach($r as $rr) {
+                       if($rr['scale'] == 5)
+                               $havescale = true;
+               }
+
                // set an already uloaded photo as profile photo
                // if photo is in 'Profile Photos', change it in db
-               if ($r[0]['album']== t('Profile Photos')){
+               if (($r[0]['album']== t('Profile Photos')) && ($havescale)){
                        $r=q("UPDATE `photo` SET `profile`=0 WHERE `profile`=1 AND `uid`=%d",
                                intval(local_user()));
                        
@@ -186,7 +192,7 @@ function profile_photo_content(&$a) {
 
        if(! x($a->config,'imagecrop')) {
        
-               $tpl = file_get_contents('view/profile_photo.tpl');
+               $tpl = get_markup_template('profile_photo.tpl');
 
                $o .= replace_macros($tpl,array(
                        '$user' => $a->user['nickname'],
@@ -201,7 +207,7 @@ function profile_photo_content(&$a) {
        else {
                $filename = $a->config['imagecrop'] . '-' . $a->config['imagecrop_resolution'] . '.jpg';
                $resolution = $a->config['imagecrop_resolution'];
-               $tpl = file_get_contents("view/cropbody.tpl");
+               $tpl = get_markup_template("cropbody.tpl");
                $o .= replace_macros($tpl,array(
                        '$filename' => $filename,
                        '$resource' => $a->config['imagecrop'] . '-' . $a->config['imagecrop_resolution'],
@@ -236,7 +242,7 @@ function profile_photo_crop_ui_head(&$a, $ph){
        $r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 0 );   
 
        if($r)
-               notice( t('Image uploaded successfully.') . EOL );
+               info( t('Image uploaded successfully.') . EOL );
        else
                notice( t('Image upload failed.') . EOL );
 
@@ -252,7 +258,7 @@ function profile_photo_crop_ui_head(&$a, $ph){
 
        $a->config['imagecrop'] = $hash;
        $a->config['imagecrop_resolution'] = $smallest;
-       $a->page['htmlhead'] .= file_get_contents("view/crophead.tpl");
+       $a->page['htmlhead'] .= get_markup_template("crophead.tpl");
        return;
 }}