Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 354425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:55:22+00:00 2026-05-12T11:55:22+00:00

I have a question about IPTC metadata. Is it possible to search images that

  • 0

I have a question about IPTC metadata. Is it possible to search images that aren’t in a database by their IPTC metadata (keywords) and show them and how would I go about doing this? I just need a basic idea.

I know there is the iptcparse() function for PHP.

I have already written a function to grab the image name, location, and extension for all images within a galleries folder and all subdirectories by .jpg extension.

I need to figure out how to extract the metadata without storing it in a database and how to search through it, grab the relevant images that match the search tag (their IPTC keywords should match) and how to display them. I know at the point that I have the final results (post search) i can echo an imagetag with src=”$filelocation”> if i have the final results in an array.

Basically, I am not sure if I need to store all my images into a mysql database and also extract the keywords and store them in the database as well before I can actually search and display the results. Also, if you could guide me to any gallery that already is able to do this, that could help as well.

Thanks for any help regarding this issue.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:55:23+00:00Added an answer on May 12, 2026 at 11:55 am

    It is not clear what in particular is giving you problems, but perhaps this will give you some ideas:

    <?php
    # Images we're searching
    $images = array('/path/to/image.jpg', 'another-image.jpg');
    
    # IPTC keywords to values (from exiv2, see below)
    $query = array('Byline' => 'Some Author');
    
    # Perform the search
    $result = select_jpgs_by_iptc_fields($images, $query);
    
    # Display the results
    foreach ($result as $path) {
        echo '<img src="', htmlspecialchars($path), '">';
    }
    
    function select_jpgs_by_iptc_fields($jpgs, $query) {
        $matches = array();
        foreach ($jpgs as $path) {
            $iptc = get_jpg_iptc_metadata($path);
            foreach ($query as $name => $values) {
                if (!is_array($values))
                    $values = array($values);
                if (count(array_intersect($iptc[$name], $values)) != count($values))
                    continue 2;
            }
            $matches[] = $path;
        }
        return $matches;
    }
    
    function get_jpg_iptc_metadata($path) {
        $size = getimagesize($path, $info);
        if(isset($info['APP13']))
        {
            return human_readable_iptc(iptcparse($info['APP13']));
        }
        else {
            return null;
        }
    }
    
    function human_readable_iptc($iptc) {
    # From the exiv2 sources
    static $iptc_codes_to_names =
    array(    
    // IPTC.Envelope-->
    "1#000" => 'ModelVersion',
    "1#005" => 'Destination',
    "1#020" => 'FileFormat',
    "1#022" => 'FileVersion',
    "1#030" => 'ServiceId',
    "1#040" => 'EnvelopeNumber',
    "1#050" => 'ProductId',
    "1#060" => 'EnvelopePriority',
    "1#070" => 'DateSent',
    "1#080" => 'TimeSent',
    "1#090" => 'CharacterSet',
    "1#100" => 'UNO',
    "1#120" => 'ARMId',
    "1#122" => 'ARMVersion',
    // <-- IPTC.Envelope
    // IPTC.Application2 -->
    "2#000" => 'RecordVersion',
    "2#003" => 'ObjectType',
    "2#004" => 'ObjectAttribute',
    "2#005" => 'ObjectName',
    "2#007" => 'EditStatus',
    "2#008" => 'EditorialUpdate',
    "2#010" => 'Urgency',
    "2#012" => 'Subject',
    "2#015" => 'Category',
    "2#020" => 'SuppCategory',
    "2#022" => 'FixtureId',
    "2#025" => 'Keywords',
    "2#026" => 'LocationCode',
    "2#027" => 'LocationName',
    "2#030" => 'ReleaseDate',
    "2#035" => 'ReleaseTime',
    "2#037" => 'ExpirationDate',
    "2#038" => 'ExpirationTime',
    "2#040" => 'SpecialInstructions',
    "2#042" => 'ActionAdvised',
    "2#045" => 'ReferenceService',
    "2#047" => 'ReferenceDate',
    "2#050" => 'ReferenceNumber',
    "2#055" => 'DateCreated',
    "2#060" => 'TimeCreated',
    "2#062" => 'DigitizationDate',
    "2#063" => 'DigitizationTime',
    "2#065" => 'Program',
    "2#070" => 'ProgramVersion',
    "2#075" => 'ObjectCycle',
    "2#080" => 'Byline',
    "2#085" => 'BylineTitle',
    "2#090" => 'City',
    "2#092" => 'SubLocation',
    "2#095" => 'ProvinceState',
    "2#100" => 'CountryCode',
    "2#101" => 'CountryName',
    "2#103" => 'TransmissionReference',
    "2#105" => 'Headline',
    "2#110" => 'Credit',
    "2#115" => 'Source',
    "2#116" => 'Copyright',
    "2#118" => 'Contact',
    "2#120" => 'Caption',
    "2#122" => 'Writer',
    "2#125" => 'RasterizedCaption',
    "2#130" => 'ImageType',
    "2#131" => 'ImageOrientation',
    "2#135" => 'Language',
    "2#150" => 'AudioType',
    "2#151" => 'AudioRate',
    "2#152" => 'AudioResolution',
    "2#153" => 'AudioDuration',
    "2#154" => 'AudioOutcue',
    "2#200" => 'PreviewFormat',
    "2#201" => 'PreviewVersion',
    "2#202" => 'Preview',
    // <--IPTC.Application2
          );
       $human_readable = array();
       foreach ($iptc as $code => $field_value) {
           $human_readable[$iptc_codes_to_names[$code]] = $field_value;
       }
       return $human_readable;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have question about database optimizing, indexing. I have table that called projects and
https://stackoverflow.com/a/64983/468251 - Hello, I have question about this code, how made that working with
I have a question about pyes (Python API of the ElasticSearch). Is it possible
I have question about parsing in Html helper : I have sth like: @foreach
I have question about clean thory in Python. When: @decorator_func def func(bla, alba): pass
I have question about XSLT1.0. The task is to write out in HTML all
I have question about normalization. Suppose I have an applications dealing with songs. First
I have question about interpreting strings as packed binary data in C++. In python,
i have question about YAJLiOS parser... I have next json data : {{ body
I have a question about this formula from a book: EFW (cm,kg)= 10^(-1,7492+(0,166*BPD)+(0,046*AC)-(2,646*AC*BPD/1000)) The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.