]> git.mxchange.org Git - friendica.git/commitdiff
auto-orient uploaded wall photos and profile photos also
authorZach Prezkuta <fermion@gmx.com>
Sun, 8 Jul 2012 15:18:05 +0000 (09:18 -0600)
committerZach Prezkuta <fermion@gmx.com>
Sun, 8 Jul 2012 15:18:05 +0000 (09:18 -0600)
include/Photo.php
mod/photos.php
mod/profile_photo.php
mod/wall_upload.php

index 3af1691ee7250880479de51ec3573fb5e2839a05..f07019e714dbbf4c2fb45c3390258133601c200f 100644 (file)
@@ -143,7 +143,7 @@ class Photo {
        public function orient($filename) {
                // based off comment on http://php.net/manual/en/function.imagerotate.php
 
-               if(! function_exists('exif_read_data'))
+               if( (! function_exists('exif_read_data')) || ($this->getType() === 'image/png') )
                        return;
 
                $exif = exif_read_data($filename);
index 42cad42f9c9bed557c40077a1877f09b87a20ee5..624f0bdcaa2038367cffb47bd0780deeffade527 100644 (file)
@@ -740,8 +740,7 @@ function photos_post(&$a) {
                killme();
        }
 
-        if($ph->getType() != 'image/png')
-            $ph->orient($src);
+       $ph->orient($src);
        @unlink($src);
 
        $max_length = get_config('system','max_image_length');
index e44707f9bba8396da0b69e399d6622c137f32138..67b2c4ab411f6ecd653bb0ec159134691662ee70 100644 (file)
@@ -128,6 +128,7 @@ function profile_photo_post(&$a) {
                return;
        }
 
+       $ph->orient($src);
        @unlink($src);
        return profile_photo_crop_ui_head($a, $ph);
        
@@ -237,6 +238,12 @@ function profile_photo_content(&$a) {
 
 if(! function_exists('_crop_ui_head')) {
 function profile_photo_crop_ui_head(&$a, $ph){
+       $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();
 
index 5990f28344b92b0c2007538d159e3aac15f6647e..07d97d17a9e21fa15809a7f325d81c554409657d 100644 (file)
@@ -101,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();