Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/content/60/9972860/html/smf/Sources/Load.php(225) : runtime-created function on line 3
Image unique ID from digital camera [EOS] into a custom field
The DAM Forum
Welcome, Guest. Please login or register.
February 20, 2019, 12:37:16 PM

Login with username, password and session length
Search:     Advanced search
28033 Posts in 5147 Topics by 2904 Members
Latest Member: kbroch
* Home Help Search Login Register
+  The DAM Forum
|-+  Software Discussions
| |-+  Scripting
| | |-+  Image unique ID from digital camera [EOS] into a custom field
« previous next »
Pages: [1] Print
Author Topic: Image unique ID from digital camera [EOS] into a custom field  (Read 23194 times)
Duncan Skelton
Newbie
*
Posts: 12


View Profile WWW
« on: September 20, 2007, 09:31:05 AM »

Hi,
I use long filenames for my RAW/derivative files as per the DAM book suggestions. When it comes to generating HTML galleries though I think these long names are too much for clients to handle. When they pick images from their gallery and communicate them to the photographer they need to do this with minimum faff.

Ideally the images should just have a short unique id that the photographer can immediately match to the correct master image in the catalog/archive.

It strikes me that the unique image id generated by the camera is the right thing to use - the chances of the number wrapping and producing a duplicate id within the space of a single shoot is practically nil. Adobe Bridge exposes this important metadata as part of the file rename utility, and so I had assumed that iViewMediaPro/Expression Media would grant similar access.

However, - I don't see a way of getting at it within the HTML Template documentation, and assume that resorting to scripting is the only way.

The best I've done so far is to Batch Rename the gallery set of images using the find/replace options to manually strip out the irrelevant bits of the filename just leaving the unique image id. (See http://www.georginashellard.com/client/portrait/bld1/index.html)

Anyone got any ideas, or alternative ways of approaching the same problem ?

Many thanks.
duncan.
« Last Edit: September 20, 2007, 09:33:49 AM by Duncan Skelton » Logged

Climbing photography from Offwidth Images
johnbeardy
Administrator
Hero Member
*****
Posts: 1813


View Profile WWW
« Reply #1 on: September 20, 2007, 01:28:02 PM »

I assume you're using xMedia to generate the galleries? I display my images' unique ID's, characters 7-13, using a JavaScript in the web template. So the key bit of the template looks like this.

Code:
<script language="JavaScript" type="text/JavaScript">
var iViewValue = "(iView:Filename)";
    var jbVal = iViewValue.substring( 7, 13);
    document.writeln (jbVal); 

              </script>
          <noscript>
  (iView:Filename)
          </noscript>

What it's doing is adding a JavaScript to the file, and writing the full filename directly into the script that each web page generated by iView/xMedia. An example looks like this:

Code:
<script language="JavaScript" type="text/JavaScript">
var iViewValue = "070826_053286 Nantwich.dng";
    var jbVal = iViewValue.substring( 7, 13);
    document.writeln (jbVal); 

              </script>
          <noscript>
            070826_053286 Nantwich.dng
        </noscript>

When the browser reads the script, it parses out the unique ID and writes it into the page.

John
Logged
Duncan Skelton
Newbie
*
Posts: 12


View Profile WWW
« Reply #2 on: September 20, 2007, 02:15:23 PM »

John,
Thanks for the quick response.
Yes - xMedia is doing the grunt work with the HTML galleries.
I can see how your Javascript is doing the necessary there - and I have to admit I hadn't really thought of that. I could use that solution. I guess there is a PHP alternative to do the same thing server-side. Thanks for the guidance.

It does seem like a sledgehammer approach. Does that mean that as far as you are aware xMedia won't support me in isolating the unique image id like bridge ? That would seem worthy of a feature request to me. If this is indeed the case I'll try emailing the support team.

Thanks again.
Duncan.
Logged

Climbing photography from Offwidth Images
johnbeardy
Administrator
Hero Member
*****
Posts: 1813


View Profile WWW
« Reply #3 on: September 20, 2007, 02:30:03 PM »

I have asked for functions in the templates and know they have been discussed. One response was that a server or client side script could achieve much more than they'd ever build in, and those who would use it would be the sort of people who would find the alternatives anyway.

You can easily adapt that script to PHP, because I agree there are always people who'll switch JS off. I don't know why I didn't do it, other than I sometimes burn demo sites onto a CD and it's good to retain that client side option. So I don't agree it's a sledgehammer job - I find it more elegant than having to remember to run a script to populate a custom field and using up one field for what is always a calculated value.

John
Logged
johnbeardy
Administrator
Hero Member
*****
Posts: 1813


View Profile WWW
« Reply #4 on: September 20, 2007, 02:43:49 PM »

Does that mean that as far as you are aware xMedia won't support me in isolating the unique image id like bridge ?
It depends. The unique ID isn't a consistent or standard feature of the raw or jpeg file, and Bridge is better at guessing what was written in camera. but if you make it consistent, using the filename, then iView/xMedia scripts can address it.
John

Logged
Duncan Skelton
Newbie
*
Posts: 12


View Profile WWW
« Reply #5 on: September 20, 2007, 03:40:11 PM »

John,
Those are all good points, and I'll take back the sledgehammer comment. I'll take a look at how the PHP would look to compare to the javascript.

This design will work well with my current solution - I only display the filename of interest on the media pages, and not the index pages. Since there is only 1 image per media page then this will work. (The javascript above would be pasted into the relevant part of the media template file).

If it was desirable to get these calculated filenames displaying as thumbnail titles on the index pages then more work would be needed wouldn't it ?  For me that's not worth it currently. Having xMedia generate customised HTML Galleries is a great time-saver, and you lose a lot of value if you end up having to hack the 'compiled' HTML index files that result.

Thanks again.
/duncan.
Logged

Climbing photography from Offwidth Images
johnbeardy
Administrator
Hero Member
*****
Posts: 1813


View Profile WWW
« Reply #6 on: September 20, 2007, 10:37:14 PM »

"Having xMedia generate customised HTML Galleries is a great time-saver, and you lose a lot of value if you end up having to hack the 'compiled' HTML index files that result."

Duncan

Maybe there's a misunderstanding here? I'm not hacking the "compiled" HTML at any point, just changing the template, so I posted the script as it looks in the template, and its "compiled" output as it looks in the browser with View Source. You can put exactly the same script into the index pages too - I do so. Sorry if you understood this - I just wasn't sure.

Another advantage of the template/script approach is that I can vary the parsing at run time by using "theme fields". I don't do it here, but templates I've sold other photographers include theme field settings so they can change which characters are extracted (my 7 to 13 characters). This allows for any changes of naming convention, and means they can put 0 and 0 to suppress the unique ID or 0 and 100 to include it all.

John

John
Logged
Duncan Skelton
Newbie
*
Posts: 12


View Profile WWW
« Reply #7 on: September 21, 2007, 12:10:53 PM »

Hi John.
I understood you were only adding script to the template file, but I'd missed a trick. I'd assumed you were only adding the script to the media template, and that it wouldn't work for the index template. I've just experimented and found it does exactly the right thing - as you said it would ! Perfect ! My assumption that it wouldn't work for the index file is what led me to figure I'd have to hand edit the generated/compiled index pages - but that's simply not true  Grin Cool.

Loosely speaking then my index template could look like this....
         <div id="gallery">   
            <span class="index">(iView:Index)</span>
            <ul>
               (iView:IndexRowStart)
               (iView:IndexColStart)
                  <li>(iView:Preview)<\br />(iView:Filename)
                  </li>
               (iView:IndexColEnd)
               (iView:IndexRowEnd)
            </ul>
         </div>

(the <\br /> was supposed to be a regular html line break but I couldn't get it show without being processed as such so escaped it!!!!)

...and one can replace the direct reference to (iView:Filename) with your javascript or PHP equivalent.  (I spotted only recently that you can ask xMedia to generate appropriate file extension -.htm / .html / .php ...) This is exactly what I was looking for.

The HTML generation and templating capabilities of xMedia/iView is a real winner - very powerful.

I take your comments about the Theme Fields on board as well - that adds an ability to parameterise the HTML generation which gives even more flexibility. I've just started to see the potential here.

Thanks for your help. I think I'm there now !
Logged

Climbing photography from Offwidth Images
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!