สอบถาม การอ่านข้อมูลไฟล์ภาพ

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: สอบถาม การอ่านข้อมูลไฟล์ภาพ

Re: สอบถาม การอ่านข้อมูลไฟล์ภาพ

โดย Chayyim » 21/08/2012 1:13 am

ขอบคุณมากครับ เดี๋ยวขอลองก่อนนะครับ

Re: สอบถาม การอ่านข้อมูลไฟล์ภาพ

โดย tohkai_php » 20/08/2012 10:38 am

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

<?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
น่าจะได้สักวิธี เหอะๆ

Re: สอบถาม การอ่านข้อมูลไฟล์ภาพ

โดย tohkai_php » 20/08/2012 10:32 am

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

// 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. 
แล้วต้องไปแปลง ASCII อีกทีนะครับ

Re: สอบถาม การอ่านข้อมูลไฟล์ภาพ

โดย mindphp » 20/08/2012 10:07 am

กระทู้เก่ามี ครับลองค้นดู

Re: สอบถาม การอ่านข้อมูลไฟล์ภาพ

โดย Chayyim » 20/08/2012 9:55 am

ดันนิส มีใครพอจะรู้ไหมครับ

สอบถาม การอ่านข้อมูลไฟล์ภาพ

โดย Chayyim » 18/08/2012 9:41 pm

อยากทราบวิธีการอ่านข้อมูลจากไฟล์ภาพ jpeg ครับ เช่น เมื่อเราอัพโหลดไฟล์เข้าไปแล้วก็จะแสดงรายละเอียดเกี่ยวกับภาพเช่น รุ่นของกล้องที่ใช้ถ่ายภาพ ความเร็วชัตเตอร์ประมาณนี้ครับ
ภาพตัวอย่าง
ภาพตัวอย่าง
ttt.jpg (7.51 KiB) Viewed 2490 times

ข้างบน