auto-orient uploaded wall photos and profile photos also
This commit is contained in:
parent
63f10f6c6b
commit
9fbe921051
|
@ -143,7 +143,7 @@ class Photo {
|
||||||
public function orient($filename) {
|
public function orient($filename) {
|
||||||
// based off comment on http://php.net/manual/en/function.imagerotate.php
|
// 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;
|
return;
|
||||||
|
|
||||||
$exif = exif_read_data($filename);
|
$exif = exif_read_data($filename);
|
||||||
|
|
|
@ -740,8 +740,7 @@ function photos_post(&$a) {
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($ph->getType() != 'image/png')
|
$ph->orient($src);
|
||||||
$ph->orient($src);
|
|
||||||
@unlink($src);
|
@unlink($src);
|
||||||
|
|
||||||
$max_length = get_config('system','max_image_length');
|
$max_length = get_config('system','max_image_length');
|
||||||
|
|
|
@ -128,6 +128,7 @@ function profile_photo_post(&$a) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ph->orient($src);
|
||||||
@unlink($src);
|
@unlink($src);
|
||||||
return profile_photo_crop_ui_head($a, $ph);
|
return profile_photo_crop_ui_head($a, $ph);
|
||||||
|
|
||||||
|
@ -237,6 +238,12 @@ function profile_photo_content(&$a) {
|
||||||
|
|
||||||
if(! function_exists('_crop_ui_head')) {
|
if(! function_exists('_crop_ui_head')) {
|
||||||
function profile_photo_crop_ui_head(&$a, $ph){
|
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();
|
$width = $ph->getWidth();
|
||||||
$height = $ph->getHeight();
|
$height = $ph->getHeight();
|
||||||
|
|
||||||
|
|
|
@ -101,8 +101,15 @@ function wall_upload_post(&$a) {
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ph->orient($src);
|
||||||
@unlink($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();
|
$width = $ph->getWidth();
|
||||||
$height = $ph->getHeight();
|
$height = $ph->getHeight();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user