สอบถาม การอ่านข้อมูลไฟล์ภาพ
Moderators: mindphp, ผู้ดูแลกระดาน
- Chayyim
- PHP Sr. Member
- Posts: 79
- Joined: 16/05/2012 4:01 pm
- Contact:
สอบถาม การอ่านข้อมูลไฟล์ภาพ
อยากทราบวิธีการอ่านข้อมูลจากไฟล์ภาพ jpeg ครับ เช่น เมื่อเราอัพโหลดไฟล์เข้าไปแล้วก็จะแสดงรายละเอียดเกี่ยวกับภาพเช่น รุ่นของกล้องที่ใช้ถ่ายภาพ ความเร็วชัตเตอร์ประมาณนี้ครับ
- Chayyim
- PHP Sr. Member
- Posts: 79
- Joined: 16/05/2012 4:01 pm
- Contact:
- mindphp
- ผู้ดูแลระบบ MindPHP
- Posts: 27203
- Joined: 22/09/2008 6:18 pm
- Contact:
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
- Posts: 95
- Joined: 10/04/2012 9:09 am
Re: สอบถาม การอ่านข้อมูลไฟล์ภาพ
Code: Select all
// 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);
Code: Select all
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
- Posts: 95
- Joined: 10/04/2012 9:09 am
Re: สอบถาม การอ่านข้อมูลไฟล์ภาพ
Code: Select all
<?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";
}
}
?>
Code: Select all
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
- Posts: 79
- Joined: 16/05/2012 4:01 pm
- Contact:
Re: สอบถาม การอ่านข้อมูลไฟล์ภาพ
ขอบคุณมากครับ เดี๋ยวขอลองก่อนนะครับ
-
- Similar Topics
- Replies
- Views
- Last post
-
- 6 Replies
- 2164 Views
-
Last post by A2d
03/07/2020 12:03 am
-
- 1 Replies
- 1526 Views
-
Last post by Chayyim
31/08/2012 8:16 am
-
-
สอบถาม วิธีการนับเวลาในไฟล์วีดีโอครับ
by jirawoot » 19/08/2019 11:34 am » in Programming - C/C++ & java & Python - 1 Replies
- 402 Views
-
Last post by jirawoot
19/08/2019 5:07 pm
-
-
- 4 Replies
- 5582 Views
-
Last post by kowit2
03/01/2013 1:15 pm
-
-
สอบถาม php ข้อมูลไม่แสดง
by AePongsak » 01/08/2018 4:40 pm » in ปัญหาการใช้ phpBB3, SMF, Joomla, Wordpress, CMS, CRM - 2 Replies
- 1090 Views
-
Last post by AePongsak
01/08/2018 6:38 pm
-
-
- 1 Replies
- 625 Views
-
Last post by mindphp
11/05/2017 6:21 am
Who is online
Users browsing this forum: No registered users and 11 guests