Joomla-Ukraine/JUNewsUltra

Add IPTC metadata to thumbnails

Sulpher opened this issue · 2 comments

В Германии есть закон, обязывающий, чтобы IPTC meta-данные содержались в том числе и в мини-эскизах.
Сделать это опционально (т.к. лишние данные)

Далее приведу выдержки из переписки с коллегой, поэтому на англ:

If you do thumbnails of images on your web, in germany, you need to add copyright notices from IPTC even to all thumbnails.

In German law is, that IPTC info is a part of the image and you cannot delete it. So if you e.g. use an image from Unsplash and it includes IPTC with copyright, you should add it to all thumbnails you will make - e.g. if you use img tag with different sizes for different screens - all should have the information about copyright

А вот такое решение предлагается:

/*
$fileIn ... original image
$fileOut ... destination image (e.g. thumbnail)
*/
$copyright = array();
$info = array();
$data = '';
$size = getimagesize($fileIn, $info);
if(isset($info['APP13'])){
  $iptc = iptcparse($info['APP13']);
  if(isset($iptc['2#116'][0]) && $iptc['2#116'][0] != ''){
    $iptcEmbed = array('2#116' => $iptc['2#116'][0]);
    foreach($iptcEmbed as $tag => $string) {
      $tag = substr($tag, 2);
      // iptc_make_tag Funktion kann man hier finden:
      // https://www.php.net/manual/en/function.iptcembed.php (example 1)
      $data .= iptc_make_tag(2, $tag, $string);
    }
    $content = iptcembed($data, $fileOut);
    // Man kann hier auch Joomla! JFile Methode benutzen
    // test the $data or $content so the file will be not open and overwritten uselessly
    $fw = fopen($fileOut, 'w');
    fwrite($fw, $content);
    fclose($fw);
  }
}

It will slow down the procedure of thumbnail creation and the thumbnails will be larger - so, such a solution should be optional for users from the rest of the countries.

The copyright info ads cca 86 bytes + the copyright notice text so if this is only the copyright info, it is all OK, but if it should be all the IPTC data, then this can be drastically, for example, small image thumbnail in the component can have e.g. 700 bytes.

Штука интересная и нужная для немецкоговорящего рынка, тем более, как я понимаю, решение уже есть.
Решение стоит продублировать в JUMultiThumb.

надо же, эту штуку часто внедряют в различные галереи.
даже в таком старом расширении реализовали:
https://extensions.joomla.org/extension/bk-multithumb/
IPTC Caption support was added.

и тут:
https://hunyadi.info.hu/levente/en/sigplus/faq

sigplus uses the function iptcparse to extract metadata from images. This function does not understand non-standard IPTC metadata and if it encounteres such, it cannot extract any metadata from the image file, not even those it would recognize otherwise. Image manipulation software can usually be configured in such a way as to leave out proprietary IPTC metadata extensions.

UPD:
вот еще нашел полезную информацию с предлагаемым решением:

If someone would like to have the EXIF ​​data as additional information in their slideshow, they can include this JS plugin in their override:
https://github.com/exif-js/exif-js

интересная информация:

Как бороться с кражей изображений
Для этого используются мета-теги внутри самого изображения по стандарту IPTC. Если ваше изображение содержит подобные теги (а оно должно их содержать), то в случае кражи для Google вы все равно остаетесь его источником.

Даже если изображение украли и удалили оттуда ваши теги, Google все равно воспринимает вас как источник, т.к. он отдает приоритет источникам с прописанными мета-тегами. В документации Google об этом стандарте написано.

Минимальное количество параметров, которые нужно обязательно прописать:

  1. By-line, Artist, Creator – взаимозаменяемые;

  2. CopyrightNotice (ссылка на лицензию и описание лицензии);

  3. Source, Credit – здесь прописать ссылку на ваш сайт или источник изображения.

Если у вас украдут картинку и забудут удалить эти мета-теги, то вы получите положительный эффект.
https://devsday.ru/blog/details/20644