making IPTC data searchable

前端 未结 2 548
别那么骄傲
别那么骄傲 2021-01-17 05:43

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 do

2条回答
  •  盖世英雄少女心
    2021-01-17 06:44

    If you don't have extracted those IPTC data from your images, each time someone will search, you'll have to :

    • loop on every images
    • for each image, extract the IPTC data
    • see if the IPTC data for the current image matches

    If you have more than a couple image, this will be really bad for performances, I'd say.


    So, in my opinion, it would be far better to :

    • add a couple of fields in your database
    • extract the relevant IPTC data when the image is uploaded / stored
    • store the IPTC data in those DB fields
    • search in those DB fields
      • Or use some search engine like Lucene or Sphinx -- but that is another problem.

    It'll mean a bit more work for you right now : you have more code to write...

    ... But it also means your website will have better chances to survive when there are several images and many users doing searches.

提交回复
热议问题