4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: fotograf on October 04, 2002, 06:17:09 AM

Title: Auto IPTC into discription field when check new images
Post by: fotograf on October 04, 2002, 06:17:09 AM
I want, that after loading new the image on FTP, and start of command CHECK NEW IMAGES, there were new images and the information from IPTC info DISCRIPTIN was automatically transferred. If somebody knows as to make it inform me please.
Title: Auto IPTC into discription field when check new images
Post by: Jan on October 04, 2002, 08:46:16 AM
Try this. Open "admin/checkimages.php" an replace
Code: [Select]
show_textarea_row($title, "image_description_".$i, "", $textarea_size);
with
Code: [Select]
$caption = "";
if ($imageinfo = @getimagesize($file_src, $info)) {
  if (isset($info['APP13'])) {
    $iptc = iptcparse($info['APP13']);
    if (is_array($iptc)) {
      $caption = (isset($iptc['2#120'][0])) ? $iptc['2#120'][0] : "";
    }
  }
}
show_textarea_row($title, "image_description_".$i, $caption, $textarea_size);


Jan
Title: Auto IPTC into discription field when check new images
Post by: edwin on October 04, 2002, 07:32:01 PM
Great, just what i'm looking for, but i need also the keywords and the date created
Do i just have to copy the line of the caption and chance the line or can you place a example

again great, save a lot of work
Title: Auto IPTC into discription field when check new images
Post by: fotograf on October 04, 2002, 08:08:57 PM
Unfortunately. Has not helped. Mistakes any did not give out. But the information from IPTC automatically in a field of the description was not transferred :cry:
I am sorry for my bad English. It is machine translation..
Title: Auto IPTC into discription field when check new images
Post by: fotograf on October 04, 2002, 08:15:44 PM
Yes, it would be excellent if the information from IPTC would automatically be transferred to corresponding fields at performance of command CHECK NEW IMAGES. whether it has turned out at you with replacement of a code, at me is not present. If it only at me does not go, can you send to me  the file modified by you. I shall be very grateful.
Title: Auto IPTC into discription field when check new images
Post by: edwin on October 04, 2002, 08:20:53 PM
i think you made a mistake because with me it it was transferred fine
i'm trying to set the date alsop but this doesn't go well till now
Title: Auto IPTC into discription field when check new images
Post by: fotograf on October 04, 2002, 08:34:02 PM
I shall search where I have made a mistake. Thanks.
Title: Auto IPTC into discription field when check new images
Post by: edwin on October 04, 2002, 08:38:45 PM
Jan or Nicky, can you help me out with the date part, i can't get this working

My experience with PHP is zero
Title: Auto IPTC into discription field when check new images
Post by: fotograf on October 04, 2002, 09:33:59 PM
And to me help too, please. When I allow command CHECK NEW IMAGES and I note DETAILED VERSION I see, THAT the INFORMATION is transferred from IPTC but after I press ADD button and I come into viewing gallery the field of the description is empty. I think to many users of your gallery it will be convenient if descriptions both key words and date will be automatically filled, at check of new images. Make, please, for us a new file checkimages.php. Let your script becomes even better.
Title: Auto IPTC into discription field when check new images
Post by: Jan on October 05, 2002, 09:10:50 AM
See the first function get_iptc_insert_link() in "admin/admin_functions.php". There you will find the code how to handle the date and the keywords.

Jan
Title: Auto IPTC into discription field when check new images
Post by: edwin on October 05, 2002, 11:56:44 AM
i tried but i'm getting a parse fault on line 342 or something like that.

please can you try to explain it for me again what i should do

regards
edwin
Title: Auto IPTC into discription field when check new images
Post by: Jan on October 05, 2002, 12:11:05 PM
Replace

Code: [Select]
$caption = (isset($iptc['2#120'][0])) ? $iptc['2#120'][0] : "";

with
Code: [Select]
if (isset($iptc['2#055'][0])) {
  $caption = $iptc['2#055'][0];
  $caption = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1-\\2-\\3", $caption);
}

for date

or

Code: [Select]
if (isset($iptc['2#025'])) {
  $caption = "";  
  foreach ($iptc['2#025'] as $val) {
    $caption .= (($caption != "" ) ? " " : "").$val;
  }
}

for keywords

Jan
Title: Auto IPTC into discription field when check new images
Post by: edwin on October 05, 2002, 01:15:17 PM
i'm very sorry Jan but this doesn't automaticly puts in the created date in the datefield but in the captionfield.
What do i have to change to get the setting right for the date field
i tought it hat to be changed in this part

    $date = date("Y-m-d H:i:s", time());
      $title = $lang['field_date'].$lang['date_desc'].$lang['date_format'].((isset($file_src)) ? get_iptc_insert_link($file_src, "date_created", "image_date_".$i, 0) : "");
      show_input_row($title, "image_date_".$i, $date, $textinput_size);

Please, help me so this program wil be perfect for me

PS. i'm using 1.6 mayby 1.7 is different
Title: Auto IPTC into discription field when check new images
Post by: Jan on October 05, 2002, 01:33:33 PM
Place
Code: [Select]
if ($imageinfo = @getimagesize($file_src, $info)) {
  if (isset($info['APP13'])) {
    $iptc = iptcparse($info['APP13']);
    if (is_array($iptc)) {
      if (isset($iptc['2#055'][0])) {
        $date = $iptc['2#055'][0];
        $date = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1-\\2-\\3", $date);
      }
    }
  }
}

after
Code: [Select]
$date = date("Y-m-d H:i:s", time());
Jan
Title: Auto IPTC into discription field when check new images
Post by: edwin on October 05, 2002, 01:43:20 PM
YES YES YES YES YES YES YES YES YES YES  :D  :D  :D  :D  :D
 :)
      :wink:

                :P

YOU ARE THE MASTER

thank you, very well

regards edwin
Title: Auto IPTC into discription field when check new images
Post by: fotograf on October 09, 2002, 10:22:57 PM
Quote from: Jan
See the first function get_iptc_insert_link() in "admin/admin_functions.php". There you will find the code how to handle the date and the keywords.

Jan



And, what in this file I need to correct? Help me please. :?:
Title: Auto IPTC into discription field when check new images
Post by: fotograf on December 16, 2002, 12:51:40 PM
Sorry this is I again. I get some good rezults, I have automate caption and date information, but  I can't have good rezult with keywords. Explane me please !!!!!
Title: What is IPTC system How to do that???
Post by: mantra on December 17, 2002, 01:41:03 AM
I am beginner in this program, could any body explain?
What is IPTC system How to do that??? :o  :o
Title: International Press Telecommunications Council
Post by: Chris on December 17, 2002, 02:59:55 AM
Check out www.IPTC.org for more info.
Quote
IPTC is a standard of The International Press Telecommunications Council, and was designed to identify transmitted text and images.

This standard includes entries for captions, keywords, categories, credits, and origins. IPTC is supported by programs such as Adobe Photoshop, PhotoThumb, and most professional image database software.

IPTCExt is a free shell extension for Windows that adds shell support for viewing and editing IPTC info in JPEG image files.


Since this is FREEWARE, I'll post the link:  http://photothumb.com/iptcext/

(http://photothumb.com/iptcext/iptcext_properties.gif)
Title: Auto IPTC into discription field when check new images
Post by: fotograf on December 17, 2002, 06:17:23 AM
If you use photoshop in FILE\FILE INFO you can discribe you photo. Also you can easy do it in FOTOSTATION/ Then you upload photos to your 4images site via FTP and check NEW IMAGES. near the fields for discription, date and keywords you will see buttons to move information from IPTC info. If you will click it , all that you wrote in FILE INFO will be copy in this field, it is very comfortable. And in this topic I try to understand how can I automate this without pressing buttons.
Sorry my english very bad. I have good rezult with discription and date but with keyword I have mistake.
Title: Thanks !!!! Jan can you fix the code please
Post by: mantra on December 17, 2002, 08:38:09 AM
I think this is the feature I want it ....
Jan could you fix the code please???
Is it ACDsee version 4 have IPTC ??

 8)  8)
Title: Auto IPTC into discription field when check new images
Post by: fotograf on December 17, 2002, 01:49:07 PM
ACDSee 5 has IPTC but it not comfortable. I recomend you FOTOSTATION
http://www.fotoware.com/  or ThumbsPlus http://www.cerious.com/.
Title: Re: Thanks !!!! Jan can you fix the code please
Post by: Chris on December 17, 2002, 02:00:04 PM
Quote from: mantra
Jan could you fix the code please???

There is nothing broken in the code so what is there to fix?  Please understand that what you're asking is for a feature enhancement to the product, not a bug fix.  Jan is under no obligation here.
Title: Auto IPTC into discription field when check new images
Post by: fotograf on December 17, 2002, 02:09:00 PM
I dont have in my mind that code is broken. Jan explaned what to do and I resive some good rezults, but I dont understand all good, because I dont know PHP, I am not a programist.  Thanks to Jan I change something in this file, but with keywords I made something wrong. I understand that EDWIN made this too and resive a good rezult, I dont understand something and I hope that somebody can help me. Sorry for my bad English.
Title: Auto IPTC into discription field when check new images
Post by: Chris on December 17, 2002, 04:42:53 PM
Quote from: fotograf
I dont have in my mind that code is broken.

Sorry if there was some confusion.  My reply was directed to mantra.
Title: OK Chris, I thought the code doesn't work
Post by: mantra on December 18, 2002, 02:25:58 AM
OK Chris, I thought  the code doesn't work with the keyword.
I meant if somebody can help with this problem it will be good Mood.
 8)

Because
most of people use this program not just show their images but need more word to explain the picture ,so adding  the description each images is important, if this proces more quick or easily that will be good.

BTW : this program help me a lot Thanks to all developer .
 :)  :) [/b]
Title: Auto IPTC into discription field when check new images
Post by: fotograf on December 19, 2002, 10:49:43 AM
mantra  If I understand you  have good rezult with discription and date too ??
Title: Auto IPTC into discription field when check new images
Post by: Yogen on April 21, 2003, 11:53:06 AM
hi folks,

jan, please check out this actual code in my admin/checkimages.php if it is correct, 'cause it doesn't work for me :-(
i'm using V 1.7 and my prob is to be sure that i've done all correct cause the thread belongs to 1.6
in the admin_functions.php i didn't change anything ... should i ??
and what ?

if i'm right in my understanding of the MOD, after the upload and checking new images, the iptc infos should be shown in the keyword-column of the normal pic-description table ??!!

antwort gerne auch in deutsch ;-)

geänderter code: 19:18, 29. april 03

Code: [Select]
     $title = $lang['field_description_ext'].((isset($file_src)) ? get_iptc_insert_link($file_src, "caption", "image_description_".$i) : "");

//old: show_textarea_row($title, "image_description_".$i, "", $textarea_size);

//new version
$caption = "";
if ($imageinfo = @getimagesize($file_src, $info)) {
  if (isset($info['APP13'])) {
    $iptc = iptcparse($info['APP13']);
    if (is_array($iptc)) {
    }
  }
}

  if (isset($iptc['2#055'][0])) {
  $caption = $iptc['2#055'][0];
  $caption = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1-\\2-\\3", $caption);
 }

if (isset($iptc['2#025'])) {
  $caption = "";  
  foreach ($iptc['2#025'] as $val) {
    $caption .= (($caption != "" ) ? " " : "").$val;
  }
}
 

show_textarea_row($title, "image_description_".$i, $caption, $textarea_size);
//ende new version


// neue date version
      $date = date("Y-m-d H:i:s", time());
 if ($imageinfo = @getimagesize($file_src, $info)) {  
  if (isset($info['APP13'])) {  
    $iptc = iptcparse($info['APP13']);  
    if (is_array($iptc)) {  
      if (isset($iptc['2#055'][0])) {  
        $date = $iptc['2#055'][0];  
        $date = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1-\\2-\\3", $date);  
      }  
    }  
  }  
}
// ende neue date version

      $title = $lang['field_date'].$lang['date_desc'].$lang['date_format'].((isset($file_src)) ? get_iptc_insert_link($file_src, "date_created", "image_date_".$i, 0) : "");
      show_input_row($title, "image_date_".$i, $date, $textinput_size);



thnx for any help !!

Yogen
Title: Auto IPTC into discription field when check new images
Post by: Yogen on April 28, 2003, 01:01:03 AM
hi folks, again,

is there anybody who has version 1.7 with this MOD running ????

IF, THEN please send the changed files per mail or please post the changes here...

email: yogen@gmx.de

thx !!

Yogen
Title: Auto IPTC into discription field when check new images
Post by: mdevane on May 17, 2003, 08:29:31 PM
Jan - First of all - Excellent program  :D .  I am considering building a few new sites for my kids' sports teams.  I would like to use 4images, but I typically shoot 100-150 pictures per sports event 4-5 times per week, and I use a batch IPTC editor to add captions, keywords, etc as part of my standard workflow.  

I was able to understand and modify the code for date and caption per above, but I could not understand the final instructions for Keywords replacement, which is probably the most critical.  

Could you repost the hack for automatic IPTC keyword replacement?

btw, the automatic function of IPTC replacement would make excellent addition to the codebase for your next release, since your audience would grow to include more professional photographers who, like me, tend to deal with large numbers of photographs.  Batch functionality is a basic necessity in this business.
Title: Auto IPTC into discription field when check new images
Post by: Jan on May 20, 2003, 09:56:21 AM
For keywords, replace
Code: [Select]
show_textarea_row($title, "image_keywords_".$i, "", $textarea_size);
with
Code: [Select]
$keywords = "";
if ($imageinfo = @getimagesize($file_src, $info)) {
  if (isset($info['APP13'])) {
    $iptc = iptcparse($info['APP13']);
    if (is_array($iptc)) {
      if (isset($iptc['2#025'])) {
        foreach ($iptc['2#025'] as $val) {
          $keywords .= (($value != "" ) ? " " : "").$val;
        }
      }
    }
  }
}
show_textarea_row($title, "image_keywords_".$i, $keywords, $textarea_size);
Title: Auto IPTC into discription field when check new images
Post by: Yogen on May 20, 2003, 03:28:19 PM
hallo jan,

erstmal danke für die anleitung!!
wegen der anderen user hier schreibe ich mal in englisch! ;-)

--------------
i replaced... and then i tested many times but nothing would imported into the description field :-(

as i wrote before, i use 1.7 and i don't know how to fix the problem. maybe the IPTC infos are not in a correct form?
i testet all, with comma, without, all i can do!!

do you have any suggestions about the form, or any other idea why it doesn't work ??
jan, did you tested your hack by yourself ?

greetz and thnx very much!

Yogen
PS: is there any other user now, whow uses the hack and it works ??
Title: Auto IPTC into discription field when check new images
Post by: mdevane on May 24, 2003, 09:21:44 PM
Quote from: Jan
For keywords, replace
Code: [Select]
show_textarea_row($title, "image_keywords_".$i, "", $textarea_size);
with
Code: [Select]
$keywords = "";
if ($imageinfo = @getimagesize($file_src, $info)) {
  if (isset($info['APP13'])) {
    $iptc = iptcparse($info['APP13']);
    if (is_array($iptc)) {
      if (isset($iptc['2#025'])) {
        foreach ($iptc['2#025'] as $val) {
          $keywords .= (($value != "" ) ? " " : "").$val;
        }
      }
    }
  }
}
show_textarea_row($title, "image_keywords_".$i, $keywords, $textarea_size);


Jan - when I tested this mod, it does autopopulate the keywords field, but each IPTC keyword in my images is delimited by <CR>, and the autopopulate mod concatenates the fields together into a single string in 4images.  When I use the built-in standard manual feature on the same images, it works perfectly and the fields are delimited by spaces, as they should be.

Can you review the code to verify my problem?  It is possible that keywords may be delimited by different characters (<CR>, <,>, <tab>, etc.), depending on the system which was used to create them.
Title: Auto IPTC into discription field when check new images
Post by: mdevane on May 29, 2003, 04:24:05 AM
Bump

Jan - Any suggestions on how to fix this bug?  Can't publish site without it.

thx much for your help.
Title: Auto IPTC into discription field when check new images
Post by: hansprdn on June 02, 2003, 04:50:41 PM
Jan I have the same problem.

keywords entered and no space between keywords!

please help
Title: Auto IPTC into discription field when check new images
Post by: mdevane on June 21, 2003, 05:37:53 AM
bump!
Title: Auto IPTC into discription field when check new images
Post by: Schwarzer'Engel on June 22, 2003, 12:17:56 PM
Quote from: mdevane
Jan - First of all - Excellent program  :D .  I am considering building a few new sites for my kids' sports teams.  I would like to use 4images, but I typically shoot 100-150 pictures per sports event 4-5 times per week, and I use a batch IPTC editor to add captions, keywords, etc as part of my standard workflow.  
Hello,

which IPTC-Batch-Editor use You?

Greets
Chris
Title: Auto IPTC into discription field when check new images
Post by: Schwarzer'Engel on June 22, 2003, 12:27:51 PM
Quote from: hansprdn
Jan I have the same problem.

keywords entered and no space between keywords!

please help


Hello,

replace
Code: [Select]
$keywords .= (($value != "" ) ? " " : "").$val;

with
Code: [Select]
$keywords .= (($value != "" ) ? " " : " ").$val;

You have now Space-separeted Keywords, but before the first Keyword you have an Space, but this is not a Problem. (Sorry for My Bad English).

Greets
Chris