Where does one insert meta data into and image file and what it the mark up to do so? i want to do this with php.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- How to get the background from multiple images by
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
You can go for iptcembed function in PHP to add information to image. usage could be found at: http://php.net/manual/en/function.iptcembed.php
Added data could be retrieved using iptcparse function.
Let me know if this works for you.
You can opt for a simpler alternative, that will use the
exiftool
command line tool.To use it, I have coded today for a personal project a simple PHP script that will write the Latitude/Longitude info, if you already have it in PHP variables.
And, which is very important, a way of adding the GPSLatitudeRef and GPSLongitudeRef values based on the previous ones. Basically, if the Latitude is positive, then GPSLatitudeRef should have the "North" value, and "South" if negative. For GPSLongitudeRef is the same, but being "East" when positive, and "West" when negative.
This will generate a string, with and endline character for each image. If you add a for then you can just write to it the content of
$bashExifEdit
, and voilà! An automated way of setting all the GPS details (except the altitude, which is not that different than the latitude/longitude) based on a latitude/longitude for your images.Php integration into images ;)
http://bechtsoudis.com/archive/2011/09/08/php-code-into-jpeg-metadata-from-hide-to-unhide/index.html
JPEG, TIFF, PSD, Raw and several other file formats can include any or all the following standard types of metadata:
IPTC-IIM Often called "legacy" IPTC, this schema was developed in the early 1990s, primarily to aid news organizations in captioning early digital images. Its primary advantage is that most image editing and management programs can read and write its widely compatible fields.
IPTC Core & Extension This newer schema builds on the legacy of IIM by adding more types of descriptive and administrative information, including new fields to accommodate the needs of the stock photography and cultural heritage communities, packaged in a more robust data format, "XMP."
PLUS The Picture Licensing Universal System for identifying and defining image-use licenses, describes a schema and tools for generating a string of characters that can identify a copyright holder, user, scope and terms of a licensed image use.
XMP This is the newer data format used by IPTC Core and Extension for storing and accessing image metadata. It enables metadata storage within an image file or in an accompanying sidecar file, and it permits creation of custom metadata fields.
Exif These metadata, often created by cameras and other capture devices, include technical information about an image and its capture method, such as exposure settings, capture time, GPS location information and camera model.
Dublin Core Many image libraries and a wide variety of industries store information with image files using this schema. Several of its fields are interoperable with IPTC formats.
In PHP you can use headers:
example:
You can add more headers like that one and it will work.You can even send some custom headers and it will still work :)
I recently saw a really cool article on the w3c blog about combining RDFa and an HTML
<imagemap>
to enrich images by specifying not only what's in the image but also where it is in the image: http://www.w3.org/QA/2008/01/rdfa_and_html_imagemap.htmlYou can use image libraries like imagemagick
http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=20183
There is another tool I know named Jhead which can retieve and modify some metadata if images
http://www.sentex.net/~mwandel/jhead/