สอบถาม การอ่านข้อมูลไฟล์ภาพ
Moderator: mindphp, ผู้ดูแลกระดาน
- Chayyim
- PHP Sr. Member
- โพสต์: 79
- ลงทะเบียนเมื่อ: 16/05/2012 4:01 pm
- ติดต่อ:
สอบถาม การอ่านข้อมูลไฟล์ภาพ
อยากทราบวิธีการอ่านข้อมูลจากไฟล์ภาพ jpeg ครับ เช่น เมื่อเราอัพโหลดไฟล์เข้าไปแล้วก็จะแสดงรายละเอียดเกี่ยวกับภาพเช่น รุ่นของกล้องที่ใช้ถ่ายภาพ ความเร็วชัตเตอร์ประมาณนี้ครับ
- Chayyim
- PHP Sr. Member
- โพสต์: 79
- ลงทะเบียนเมื่อ: 16/05/2012 4:01 pm
- ติดต่อ:
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41384
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: สอบถาม การอ่านข้อมูลไฟล์ภาพ
กระทู้เก่ามี ครับลองค้นดู
ติดตาม 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
ติดตาม 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
-
- PHP Sr. Member
- โพสต์: 95
- ลงทะเบียนเมื่อ: 10/04/2012 9:09 am
Re: สอบถาม การอ่านข้อมูลไฟล์ภาพ
โค้ด: เลือกทั้งหมด
// Create an Image object.
Image image = new Bitmap(@"c:\FakePhoto.jpg");
// Get the PropertyItems property from image.
PropertyItem[] propItems = image.PropertyItems;
// Set up the display.
Font font = new Font("Arial", 12);
SolidBrush blackBrush = new SolidBrush(Color.Black);
int X = 0;
int Y = 0;
// For each PropertyItem in the array, display the ID, type, and
// length.
int count = 0;
foreach (PropertyItem propItem in propItems)
{
e.Graphics.DrawString(
"Property Item " + count.ToString(),
font,
blackBrush,
X, Y);
Y += font.Height;
e.Graphics.DrawString(
" iD: 0x" + propItem.Id.ToString("x"),
font,
blackBrush,
X, Y);
Y += font.Height;
e.Graphics.DrawString(
" type: " + propItem.Type.ToString(),
font,
blackBrush,
X, Y);
Y += font.Height;
e.Graphics.DrawString(
" length: " + propItem.Len.ToString() + " bytes",
font,
blackBrush,
X, Y);
Y += font.Height;
count++;
}
// Convert the value of the second property to a string, and display
// it.
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
string manufacturer = encoding.GetString(propItems[1].Value);
e.Graphics.DrawString(
"The equipment make is " + manufacturer + ".",
font,
blackBrush,
X, Y);
โค้ด: เลือกทั้งหมด
Property Item 0
id: 0x320
type: 2
length: 16 bytes
Property Item 1
id: 0x10f
type: 2
length: 17 bytes
Property Item 2
id: 0x110
type: 2
length: 7 bytes
Property Item 3
id: 0x9003
type: 2
length: 20 bytes
Property Item 4
id: 0x829a
type: 5
length: 8 bytes
Property Item 5
id: 0x5090
type: 3
length: 128 bytes
Property Item 6
id: 0x5091
type: 3
length: 128 bytes
The equipment make is Northwind Camera.
-
- PHP Sr. Member
- โพสต์: 95
- ลงทะเบียนเมื่อ: 10/04/2012 9:09 am
Re: สอบถาม การอ่านข้อมูลไฟล์ภาพ
โค้ด: เลือกทั้งหมด
<?php
echo "test1.jpg:<br />\n";
$exif = exif_read_data('tests/test1.jpg', 'IFD0');
echo $exif===false ? "No header data found.<br />\n" : "Image contains headers<br />\n";
$exif = exif_read_data('tests/test2.jpg', 0, true);
echo "test2.jpg:<br />\n";
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
echo "$key.$name: $val<br />\n";
}
}
?>
โค้ด: เลือกทั้งหมด
test1.jpg:
No header data found.
test2.jpg:
FILE.FileName: test2.jpg
FILE.FileDateTime: 1017666176
FILE.FileSize: 1240
FILE.FileType: 2
FILE.SectionsFound: ANY_TAG, IFD0, THUMBNAIL, COMMENT
COMPUTED.html: width="1" height="1"
COMPUTED.Height: 1
COMPUTED.Width: 1
COMPUTED.IsColor: 1
COMPUTED.ByteOrderMotorola: 1
COMPUTED.UserComment: Exif test image.
COMPUTED.UserCommentEncoding: ASCII
COMPUTED.Copyright: Photo (c) M.Boerger, Edited by M.Boerger.
COMPUTED.Copyright.Photographer: Photo (c) M.Boerger
COMPUTED.Copyright.Editor: Edited by M.Boerger.
IFD0.Copyright: Photo (c) M.Boerger
IFD0.UserComment: ASCII
THUMBNAIL.JPEGInterchangeFormat: 134
THUMBNAIL.JPEGInterchangeFormatLength: 523
COMMENT.0: Comment #1.
COMMENT.1: Comment #2.
COMMENT.2: Comment #3end
THUMBNAIL.JPEGInterchangeFormat: 134
THUMBNAIL.Thumbnail.Height: 1
THUMBNAIL.Thumbnail.Height: 1
- Chayyim
- PHP Sr. Member
- โพสต์: 79
- ลงทะเบียนเมื่อ: 16/05/2012 4:01 pm
- ติดต่อ:
Re: สอบถาม การอ่านข้อมูลไฟล์ภาพ
ขอบคุณมากครับ เดี๋ยวขอลองก่อนนะครับ
-
- Similar Topics
- ตอบกลับ
- แสดง
- โพสต์ล่าสุด
-
- 0 ตอบกลับ
- 2079 แสดง
-
โพสต์ล่าสุด โดย AePongsak
31/01/2017 6:44 pm
-
- 1 ตอบกลับ
- 2577 แสดง
-
โพสต์ล่าสุด โดย mindphp
19/09/2020 4:21 pm
-
- 4 ตอบกลับ
- 2705 แสดง
-
โพสต์ล่าสุด โดย Forexduck
16/06/2022 11:33 pm
-
-
โพสต์ใหม่ สอบถาม เกี่ยวกับการเครมภาษีย้อนหลัง
โดย Likit » 21/07/2022 10:36 am » ใน ถาม - ตอบ ธุรกิจ กฏหมาย ภาษี บัญชี - 1 ตอบกลับ
- 1546 แสดง
-
โพสต์ล่าสุด โดย mindphp
24/07/2022 2:50 pm
-
ผู้ใช้งานขณะนี้
สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 115