|
#1
|
|||
|
|||
|
How to read aux:Lens from xmp image info?
How to read aux:Lens from xmp image info?
My first post, I hope this thread is where it should be. I’m trying to read lens name info from a JPG image saved from PS. From what I can conjure up with google I’ve narrowed it down to this PHP function by Pekka Saarinen http://photography-on-the.net/ee/bet...mp_to_exif.php Code:
<?php
$xmp_parsed = ee_extract_exif_from_pscs_xmp ("CRW_0016b_preview.jpg",1);
function ee_extract_exif_from_pscs_xmp ($filename,$printout=0) {
// very straightforward one-purpose utility function which
// reads image data and gets some EXIF data (what I needed) out from its XMP tags (by Adobe Photoshop CS)
// returns an array with values
// code by Pekka Saarinen http://photography-on-the.net
ob_start();
readfile($filename);
$source = ob_get_contents();
ob_end_clean();
$xmpdata_start = strpos($source,"<x:xmpmeta");
$xmpdata_end = strpos($source,"</x:xmpmeta>");
$xmplenght = $xmpdata_end-$xmpdata_start;
$xmpdata = substr($source,$xmpdata_start,$xmplenght+12);
$xmp_parsed = array();
$regexps = array(
array("name" => "DC creator", "regexp" => "/<dc:creator>\s*<rdf:Seq>\s*<rdf:li>.+<\/rdf:li>\s*<\/rdf:Seq>\s*<\/dc:creator>/"),
array("name" => "TIFF camera model", "regexp" => "/<tiff:Model>.+<\/tiff:Model>/"),
array("name" => "TIFF maker", "regexp" => "/<tiff:Make>.+<\/tiff:Make>/"),
array("name" => "EXIF exposure time", "regexp" => "/<exif:ExposureTime>.+<\/exif:ExposureTime>/"),
array("name" => "EXIF f number", "regexp" => "/<exif:FNumber>.+<\/exif:FNumber>/"),
array("name" => "EXIF aperture value", "regexp" => "/<exif:ApertureValue>.+<\/exif:ApertureValue>/"),
array("name" => "EXIF exposure program", "regexp" => "/<exif:ExposureProgram>.+<\/exif:ExposureProgram>/"),
array("name" => "EXIF iso speed ratings", "regexp" => "/<exif:ISOSpeedRatings>\s*<rdf:Seq>\s*<rdf:li>.+<\/rdf:li>\s*<\/rdf:Seq>\s*<\/exif:ISOSpeedRatings>/"),
array("name" => "EXIF datetime original", "regexp" => "/<exif:DateTimeOriginal>.+<\/exif:DateTimeOriginal>/"),
array("name" => "EXIF exposure bias value", "regexp" => "/<exif:ExposureBiasValue>.+<\/exif:ExposureBiasValue>/"),
array("name" => "EXIF metering mode", "regexp" => "/<exif:MeteringMode>.+<\/exif:MeteringMode>/"),
array("name" => "EXIF focal lenght", "regexp" => "/<exif:FocalLength>.+<\/exif:FocalLength>/"),
array("name" => "AUX lens", "regexp" => "/<aux:Lens>.+<\/aux:Lens>/")
);
foreach ($regexps as $key => $k) {
$name = $k["name"];
$regexp = $k["regexp"];
unset($r);
preg_match ($regexp, $xmpdata, $r);
$xmp_item = "";
$xmp_item = @$r[0];
array_push($xmp_parsed,array("item" => $name, "value" => $xmp_item));
}
if ($printout == 1) {
foreach ($xmp_parsed as $key => $k) {
$item = $k["item"];
$value = $k["value"];
print "<br><b>" . $item . ":</b> " . $value;
}
}
return ($xmp_parsed);
}
?>
I’ve been trying to get this custom function to work in pixelpost with modding the functions _exif.php file but my lack of PHP knowledge and a decent way to debugging has stumped me, I know this method will work but someone with a handle on PHP is needed i can be emailed at bryan AT bryan-howard DOT com |
|
#2
|
||||
|
||||
|
well first off you should not try to hack the core functions of Pixelpost. Secondly this should be done in an addon.
Third, I'll whip something up for you asap.
__________________
My photoblog, powered by PixelPost 1.9 dev SVN | My Pixelpost Addons | My Cool Photoblog profile
|
|
#3
|
|||
|
|||
|
Ok im trying to get this to work as an addon but, I’m stuck with this code
PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
|
|
#4
|
||||
|
||||
|
I'm not too familiar with the EXIF functions as I have never taken the plunge into those files but a regex like this:
Code:
aux:Lens="(.*?)" EF24-70mm f/2.8L USM from this string, aux:Lens="EF24-70mm f/2.8L USM" aux:ImageNumber="64"
__________________
Pixelpost Documentation | Visual Pixels | My Addons | Transition Bottlerocket Fund |
|
#5
|
||||
|
||||
|
I'm working on an addon as we speak.
__________________
My photoblog, powered by PixelPost 1.9 dev SVN | My Pixelpost Addons | My Cool Photoblog profile
|
|
#6
|
|||
|
|||
|
Dennis your addon will no doubt be far superior to mine and i will pick it apart when i get stuck again
|
|
#7
|
||||
|
||||
|
Howard, I seriously doubt that my addon will be far more superior, after all it is based on the same code.
__________________
My photoblog, powered by PixelPost 1.9 dev SVN | My Pixelpost Addons | My Cool Photoblog profile
|
|
#8
|
||||
|
||||
|
It's going to take a little bit more to get this all working. I can extract the info you want, but I don't want to stop there.
__________________
My photoblog, powered by PixelPost 1.9 dev SVN | My Pixelpost Addons | My Cool Photoblog profile
|
|
#9
|
|||
|
|||
|
hi there,
just wondering if there has been an progress with this addon. Thank you. |
|
#10
|
||||
|
||||
|
Yes, there is. However, I use some code which is not freely available at this point. I'm still waiting if I can release it.
__________________
My photoblog, powered by PixelPost 1.9 dev SVN | My Pixelpost Addons | My Cool Photoblog profile
|
| Post Reply |
| Thread Tools | |
|
|