mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
- code review for image rotation;
This commit is contained in:
@@ -776,10 +776,10 @@ if ( ! class_exists( 'um\admin\core\Admin_Settings' ) ) {
|
||||
),
|
||||
|
||||
array(
|
||||
'id' => 'image_fix_orientation',
|
||||
'id' => 'image_orientation_by_exif',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Fix image orientation','ultimate-member' ),
|
||||
'tooltip' => __( 'Rotate image to fix orientation by the camera Exif data.','ultimate-member'),
|
||||
'label' => __( 'Change image orientation', 'ultimate-member' ),
|
||||
'tooltip' => __( 'Rotate image to and use orientation by the camera EXIF data.', 'ultimate-member' ),
|
||||
),
|
||||
array(
|
||||
'id' => 'image_compression',
|
||||
|
||||
@@ -565,7 +565,7 @@ if ( ! class_exists( 'um\Config' ) ) {
|
||||
'mail_from' => get_bloginfo('name'),
|
||||
'mail_from_addr' => get_bloginfo('admin_email'),
|
||||
'email_html' => 1,
|
||||
'image_fix_orientation' => 1,
|
||||
'image_orientation_by_exif' => 0,
|
||||
'image_compression' => 60,
|
||||
'image_max_width' => 1000,
|
||||
'cover_min_width' => 1000,
|
||||
|
||||
@@ -745,21 +745,21 @@ if ( ! class_exists( 'um\core\Files' ) ) {
|
||||
* @return resource
|
||||
*/
|
||||
function fix_image_orientation( $rotate, $source ) {
|
||||
if ( extension_loaded('exif') ){
|
||||
if ( extension_loaded('exif') ) {
|
||||
$exif = @exif_read_data( $source );
|
||||
|
||||
if (isset($exif['Orientation'])) {
|
||||
switch ($exif['Orientation']) {
|
||||
if ( isset( $exif['Orientation'] ) ) {
|
||||
switch ( $exif['Orientation'] ) {
|
||||
case 3:
|
||||
$rotate = imagerotate($rotate, 180, 0);
|
||||
$rotate = imagerotate( $rotate, 180, 0 );
|
||||
break;
|
||||
|
||||
case 6:
|
||||
$rotate = imagerotate($rotate, -90, 0);
|
||||
$rotate = imagerotate( $rotate, -90, 0 );
|
||||
break;
|
||||
|
||||
case 8:
|
||||
$rotate = imagerotate($rotate, 90, 0);
|
||||
$rotate = imagerotate( $rotate, 90, 0 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1201,7 +1201,7 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
* @return array
|
||||
*/
|
||||
public function rotate_uploaded_image( $movefile ) {
|
||||
$image_fix_orientation = UM()->options()->get( 'image_fix_orientation' );
|
||||
$image_fix_orientation = UM()->options()->get( 'image_orientation_by_exif' );
|
||||
if ( $image_fix_orientation && $movefile['type'] == 'image/jpeg' ) {
|
||||
$image = imagecreatefromjpeg( $movefile['file'] );
|
||||
if ( $image ) {
|
||||
|
||||
Reference in New Issue
Block a user