สอบถามเรื่อง php กลับภาพตอนอัพโหลด

สำหรับผู้ที่ เริ่มต้น Programming - PHP มีอะไร แนะนำ หรือข้อสงสัยต้องบอร์ด นี้ คนที่มีความรู้ แบ่งปันคนอื่นบ้างนะ ปัญหาการเขียนโปรแกรม แบบ OOP Session Cookies php network

Moderator: mindphp, ผู้ดูแลกระดาน

ภาพประจำตัวสมาชิก
thatsawan
PHP VIP Members
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

สอบถามเรื่อง php กลับภาพตอนอัพโหลด

โพสต์ที่ยังไม่ได้อ่าน โดย thatsawan »

โค้ด: เลือกทั้งหมด

 public function imagerotate($file) {
        $image = imagecreatefromstring(file_get_contents($file));
        
      
        $exif = exif_read_data($file);
           print_r($exif); exit;
        if (!empty($exif['Orientation'])) {
            switch ($exif['Orientation']) {
                case 8:
                    $image = imagerotate($image, 90, 0);
                    break;
                case 3:
                    $image = imagerotate($image, 180, 0);
                    break;
                case 6:
                    $image = imagerotate($image, -90, 0);
                    break;
            }
        }
    }
สอบถามเรื่อง php กลับภาพตอนอัพโหลด
คือ ค่าที่เช็ค ระหว่างภาพกลับหัว กับ ภาพปกติได้ค่า

[Orientation] => 1

ตลอด ทำให้มันเช็คไม่ได้ว่าภาพนี้กลับหัวหรือป่าว


ภาพปกติได้ค่า
Array
(
[FileName] => php8825.tmp
[FileDateTime] => 1458494440
[FileSize] => 123018
[FileType] => 2
[MimeType] => image/jpeg
[SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, EXIF
[COMPUTED] => Array
(
[html] => width="397" height="599"
[Height] => 599
[Width] => 397
[IsColor] => 1
[ByteOrderMotorola] => 1
[Thumbnail.FileType] => 2
[Thumbnail.MimeType] => image/jpeg
)

[Orientation] => 1
[XResolution] => 2400/1
[YResolution] => 2400/1
[ResolutionUnit] => 2
[Software] => Microsoft Windows Photo Viewer 6.1.7600.16385
[DateTime] => 2016:03:21 00:20:30
[Exif_IFD_Pointer] => 2252
[UndefinedTag:0xEA1C] =>

[THUMBNAIL] => Array
(
[Compression] => 6
[XResolution] => 72/1
[YResolution] => 72/1
[ResolutionUnit] => 2
[JPEGInterchangeFormat] => 4426
[JPEGInterchangeFormatLength] => 10443
)


ภาพกลับหัว
Array
(
[FileName] => php6126.tmp
[FileDateTime] => 1458494626
[FileSize] => 123785
[FileType] => 2
[MimeType] => image/jpeg
[SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, EXIF
[COMPUTED] => Array
(
[html] => width="397" height="599"
[Height] => 599
[Width] => 397
[IsColor] => 1
[ByteOrderMotorola] => 1
[Thumbnail.FileType] => 2
[Thumbnail.MimeType] => image/jpeg
)

[Orientation] => 1
[XResolution] => 2400/1
[YResolution] => 2400/1
[ResolutionUnit] => 2
[Software] => Microsoft Windows Photo Viewer 6.1.7600.16385
[DateTime] => 2016:03:21 00:07:02
[Exif_IFD_Pointer] => 2252
[UndefinedTag:0xEA1C] =>
[THUMBNAIL] => Array
(
[Compression] => 6
[XResolution] => 72/1
[YResolution] => 72/1
[ResolutionUnit] => 2
[JPEGInterchangeFormat] => 4426
[JPEGInterchangeFormatLength] => 10739
)

)
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41384
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

Re: สอบถามเรื่อง php กลับภาพตอนอัพโหลด

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

ภาพกลับหัว ที่เอามาทดสอบ เอาภาพมาจากไหน กล้องมือถือ หรือเปล่าครับ
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ตอบกลับโพส

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: Google [Bot] และบุคลทั่วไป 136