]> git.mxchange.org Git - friendica.git/blobdiff - mod/wall_upload.php
modified: view/theme/smoothly/style.css
[friendica.git] / mod / wall_upload.php
index 20666e0ef45048215d24935ba4bad7a5fa67789a..07d97d17a9e21fa15809a7f325d81c554409657d 100644 (file)
@@ -69,7 +69,8 @@ function wall_upload_post(&$a) {
                $filesize = intval($_FILES['media']['size']);
                $filetype = $_FILES['media']['type'];
        }
-
+       
+    if ($filetype=="") $filetype=guess_image_type($filename);
        $maximagesize = get_config('system','maximagesize');
 
        if(($maximagesize) && ($filesize > $maximagesize)) {
@@ -78,6 +79,19 @@ function wall_upload_post(&$a) {
                killme();
        }
 
+       $r = q("select sum(octet_length(data)) as total from photo where uid = %d and scale = 0 and album != 'Contact Photos' ",
+               intval($page_owner_uid)
+       );
+
+       $limit = service_class_fetch($page_owner_uid,'photo_upload_limit');
+
+       if(($limit !== false) && (($r[0]['total'] + strlen($imagedata)) > $limit)) {
+               echo upgrade_message(true) . EOL ;
+               @unlink($src);
+               killme();
+       }
+
+
        $imagedata = @file_get_contents($src);
        $ph = new Photo($imagedata, $filetype);
 
@@ -87,8 +101,15 @@ function wall_upload_post(&$a) {
                killme();
        }
 
+       $ph->orient($src);
        @unlink($src);
 
+       $max_length = get_config('system','max_image_length');
+       if(! $max_length)
+               $max_length = MAX_IMAGE_LENGTH;
+       if($max_length > 0)
+               $ph->scaleImage($max_length);
+
        $width = $ph->getWidth();
        $height = $ph->getHeight();