]> git.mxchange.org Git - friendica.git/blobdiff - mod/profile_photo.php
send unfollow before removing ostatus contact
[friendica.git] / mod / profile_photo.php
index b21d9162a01e3622ccf6ec8a8abfc6e1f66efe5b..39808776b7e4fad331db8a0cc9028221b3f73a97 100644 (file)
@@ -42,7 +42,7 @@ function profile_photo_post(&$a) {
                $srcY = $_POST['ystart'];
                $srcW = $_POST['xfinal'] - $srcX;
                $srcH = $_POST['yfinal'] - $srcY;
-//dbg(3);
+
                $r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = %d LIMIT 1",
                        dbesc($image_id),
                        dbesc(local_user()),
@@ -68,6 +68,13 @@ function profile_photo_post(&$a) {
                                if($r === false)
                                        notice( t('Image size reduction [80] failed.') . EOL );
 
+                               $im->scaleImage(48);
+
+                               $r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 6, 1);
+                       
+                               if($r === false)
+                                       notice( t('Image size reduction [48] failed.') . EOL );
+
                                // Unset the profile photo flag from any other photos I own
 
                                $r = q("UPDATE `photo` SET `profile` = 0 WHERE `profile` = 1 AND `resource-id` != '%s' AND `uid` = %d",
@@ -90,6 +97,7 @@ function profile_photo_post(&$a) {
                        else
                                notice( t('Unable to process image') . EOL);
                }
+
                goaway($a->get_baseurl() . '/profiles');
                return; // NOTREACHED
        }
@@ -98,6 +106,14 @@ function profile_photo_post(&$a) {
        $filename = basename($_FILES['userfile']['name']);
        $filesize = intval($_FILES['userfile']['size']);
 
+       $maximagesize = get_config('system','maximagesize');
+
+       if(($maximagesize) && ($filesize > $maximagesize)) {
+               notice( t('Image exceeds size limit of ') . $maximagesize . EOL);
+               @unlink($src);
+               return;
+       }
+
        $imagedata = @file_get_contents($src);
        $ph = new Photo($imagedata);