Empty IPTC fields are being displayed Empty IPTC fields are being displayed
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Empty IPTC fields are being displayed

Started by Joachim Müller, November 29, 2007, 08:16:27 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Joachim Müller

Originally posted in http://www.pragmamx.org/Forum-topic-23114.html in German, here's the rough translation:

Quotesmall request.  :-X
I have IPTC display enabled. Only the field "Copyright" is being populated.
However, empty fields are being displayed. I have to workaround this by applying the changes suggested below to dsiplayimage.php each time I have to update:

Original code:
starting at line 191:   
if (isset($iptc) && is_array($iptc)) {
      array_walk($iptc, 'sanitize_data');
        if (isset($iptc['Title'])) $info[$lang_picinfo['iptcTitle']] = $iptc['Title'];
        if (isset($iptc['Copyright'])) $info[$lang_picinfo['iptcCopyright']] = $iptc['Copyright'];
        if (!empty($iptc['Keywords'])) $info[$lang_picinfo['iptcKeywords']] = implode(' ',$iptc['Keywords']);
        if (isset($iptc['Category'])) $info[$lang_picinfo['iptcCategory']] = $iptc['Category'];
        if (!empty($iptc['SubCategories'])) $info[$lang_picinfo['iptcSubCategories']] = implode(' ',$iptc['SubCategories']);
    }
   
Better would be:

if (isset($iptc) && is_array($iptc)) {
      array_walk($iptc, 'sanitize_data');
        if (!empty($iptc['Title'])) $info[$lang_picinfo['iptcTitle']] = $iptc['Title'];
        if (!empty($iptc['Copyright'])) $info[$lang_picinfo['iptcCopyright']] = $iptc['Copyright'];
        if (!empty($iptc['Keywords'])) $info[$lang_picinfo['iptcKeywords']] = implode(' ',$iptc['Keywords']);
        if (!empty($iptc['Category'])) $info[$lang_picinfo['iptcCategory']] = $iptc['Category'];
        if (!empty($iptc['SubCategories'])) $info[$lang_picinfo['iptcSubCategories']] = implode(' ',$iptc['SubCategories']);
    }

Could you please add this to the next version?

(my gallery resides at http://www.hppphoto.de)

Cheers xidefix

Joachim Müller

Applied suggested improvements to SVN (both of cpg1.4.x as well as cpg1.5.x). Marking thread as "fixed".